import sys input = sys.stdin.readline from collections import * N, K = map(int, input().split()) A = list(map(int, input().split())) dp1 = [False]*(K+1) dp1[0] = True dp2 = [[False]*(K+1) for _ in range(N+1)] dp2[0][0] = True for i in range(N): for j in range(K+1): if dp2[i][j]: dp2[i+1][j] = True if j+A[N-1-i]<=K: dp2[i+1][j+A[N-1-i]] = True ans = 0 for i in range(N): for j in range(K+1): if dp1[j] and dp2[N-1-i][K-j]: break else: ans += 1 for j in range(K, -1, -1): if dp1[j] and j+A[i]<=K: dp1[j+A[i]] = True print(ans)