#include <bits/stdc++.h>
long long powll(long long a, long long b) {
  long long r = 1;
  for (long long i = 0; i < (b); i++) {
    r *= a;
  }
  return r;
}
int cmp(const void *a, const void *b) {
  long long A = *(long long *)a, B = *(long long *)b;
  if (A == B)
    return 0;
  else
    return A > B ? 1 : -1;
}
int main(void) {
  long long N, x, a[105], ans = 0;
  scanf("%lld %lld", &(N), &(x));
  for (long long i = 0; i < (N); i++) scanf("%lld", &(a[i]));
  qsort(a, N, sizeof(long long), cmp);
  for (long long i = 0; i < N - 1 && x >= a[i]; i++) {
    ans++;
    x -= a[i];
  }
  printf("%lld\n", (ans + x == a[N - 1] ? 1 : 0));
  return 0;
}
