import collections N,K = map(int,input().split()) A = list(map(int, input().split())) A.sort(reverse=True) CA = collections.Counter(A) if sum(A)==K: print(N) exit() if CA[1]>K: print(0) exit() DP = [-1]*(K+1) for i in range(N): for j in reversed(range(K)): if DP[j]!=-1 and j+A[i]<=K and DP[j+A[i]]==-1: DP[j+A[i]]=i else: pass if DP[K]!=-1: break if DP[A[i]]==-1: DP[A[i]]=i if DP[K]==-1: print(-1) exit() v = K B = [] while v>0: B.append(A[DP[v]]) v-=A[DP[v]] ans = 0 minb = min(B) CB = collections.Counter(B) for k,v in CA.items(): if k