# 동전 2

동전 2 - BOJ

n, k = map(int, input().split())
li = [int(input()) for _ in range(n)]

dp = [10001] * (k + 1)
dp[0] = 0

for i in range(n):
    for j in range(li[i], k + 1):
        dp[j] = min(dp[j], dp[j - li[i]] + 1)

if dp[-1] == 10001:
    dp[-1] = -1

print(dp[-1])