#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 101;
int n, x;
int arr[MAX_N];
void solve() {
  int sum = 0;
  scanf("%d%d", &n, &x);
  for (int i = 0; i < n; i++) {
    scanf("%d", arr + i);
    sum += arr[i];
  }
  if (sum == x) {
    printf("%d", n);
    return;
  }
  if (sum > x) {
    int cnt = 0;
    while (sum > x) {
      int d = sum - x;
      int most_close = 0x3f3f3f3f;
      int pos = -1;
      for (int i = 0; i < n; i++) {
        if (arr[i] == 0) continue;
        if (abs(arr[i] - d) < most_close) most_close = abs(arr[i] - d), pos = i;
      }
      sum -= arr[pos];
      arr[pos] = 0;
      cnt++;
    }
    int res;
    if (cnt == n)
      res = 0;
    else
      res = sum == x ? n - cnt : n - cnt - 1;
    printf("%d", res);
  } else
    printf("%d", n - 1);
}
int main() {
  solve();
  return 0;
}
