#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n >> x;
  vector<int> candy(n);
  for (int i = 0; i < n; i++) {
    cin >> candy[i];
  }
  sort(candy.begin(), candy.end());
  vector<vector<int>> dp(n + 1, vector<int>(x + 1));
  for (int i = 0; i < x + 1; i++) {
    dp[0][i] = 0;
  }
  int tempi = 0, tempj = 0;
  for (int i = 1; i < n + 1; i++) {
    if (i != n) {
      for (int j = 0; j < x + 1; j++) {
        if (j >= candy[i - 1]) {
          dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - candy[i - 1]] + 1);
        } else {
          dp[i][j] = dp[i - 1][j];
        }
      }
    } else {
      int temp = 0;
      int tempi = 0;
      tempj = 0;
      for (int j = 0; j < x + 1; j++) {
        if (dp[i - 1][j] > temp) tempj = j;
      }
      if (tempj + candy[i - 1] == x) {
        dp[i][x] = dp[i - 1][tempj] + 1;
      } else {
        dp[i][x] = dp[i - 1][x];
      }
    }
  }
  cout << dp[n][x] << endl;
  return 0;
}
