maskN,K = map(int,input().split()) A = list(map(int,input().split())) P = [0] * 100010 for i in range(N): P[A[i]] += 1 A = [] for i in range(1,100010): for j in range(min(K // i + 1,P[i])): A.append(i) N = len(A) B = (1 << K) C = [0] * 100010 C[0] = 1 mask = (1 << 100010) - 1 for i in range(N): C[i + 1] = C[i] | (C[i] << A[i]) C[i + 1] &= mask if (C[N] & (1 << K)): ans = 0 for i in range(N - 1,-1,-1): if (B & C[i]) == 0: ans += 1; B |= (B >> A[i]) B &= mask print(ans) else: print(-1)