def f(A): A=["*"]+A DP=[-1]*(K+1); DP[0]=0 for i,a in enumerate(A[1:],1): for y in range(K,a-1,-1): if DP[y-a]>=0 and DP[y]==-1: DP[y]=i if DP[K]==-1: return None X=[]; x=K while x>0: X.append(DP[x]) x-=A[DP[x]] return X #================================================== N,K=map(int,input().split()) A=list(map(int,input().split())) A.sort() assert (N<=10**4) and (K<=10**3) P=f(A) if P==None: exit(print(-1)) Q=[N-k+1 for k in f(A[::-1])] print(len(set(P)&set(Q)))