import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); int[] values = new int[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt(); } boolean[][] leftDP = new boolean[n][k + 1]; leftDP[0][0] = true; leftDP[0][values[0]] = true; for (int i = 1; i < n; i++) { for (int j = 0; j <= k; j++) { if (leftDP[i - 1][j]) { leftDP[i][j] = true; if (j + values[i] <= k) { leftDP[i][j + values[i]] = true; } } } } boolean[][] rightDP = new boolean[n][k + 1]; rightDP[n - 1][0] = true; rightDP[n - 1][values[n - 1]] = true; for (int i = n - 2; i >= 0; i--) { for (int j = 0; j <= k; j++) { if (rightDP[i + 1][j]) { rightDP[i][j] = true; if (j + values[i] <= k) { rightDP[i][j + values[i]] = true; } } } } int ans = 0; for (int i = 1; i < n - 1; i++) { boolean enable = false; for (int j = 0; j <= k && !enable; j++) { enable = leftDP[i - 1][j] && rightDP[i + 1][k - j]; } if (!enable) { ans++; } } if (!rightDP[1][k]) { ans++; } if (!leftDP[n - 2][k]) { ans++; } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }