#include <bits/stdc++.h>
int dp[101][101];
int i, j, n, x, a[100], sum;
int val;
int max(int x, int y) {
  if (x < y)
    return y;
  else
    return x;
}
int rec(int i, int j) {
  if (dp[i][j] >= 0) return dp[i][j];
  int res;
  if (i == n)
    res = 0;
  else if (j < a[i]) {
    res = rec(i + 1, j);
  } else {
    res = max(rec(i + 1, j), rec(i + 1, j - a[i]) + 1);
  }
  return res;
}
int main(void) {
  scanf("%d %d", &n, &x);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  for (i = 0; i <= n; i++)
    for (j = 0; j <= n; j++) dp[i][j] = -1;
  if (sum < x)
    printf("%d\n", rec(0, x) - 1);
  else
    printf("%d\n", rec(0, x));
  return 0;
}
