#include <bits/stdc++.h>
using namespace std;
bool Compare(const pair<int, int> &a, const pair<int, int> &b) {
  return a.first < b.first;
}
const int INF = 0x3f3f3f3f;
string tostring(long long int Number) {
  string String;
  ostringstream Convert;
  Convert << Number;
  String = Convert.str();
  return String;
}
long long int toint(string String) {
  stringstream Convert(String);
  long long int Number = 0;
  Convert >> Number;
  return Number;
}
long long int MIN() { return INF; }
long long int MAX() { return -INF; }
template <typename T, typename... Args>
inline T MIN(T a, Args... args) {
  return min(a, (T)MIN(args...));
}
template <typename T, typename... Args>
inline T MAX(T a, Args... args) {
  return max(a, (T)MAX(args...));
}
int main() {
  long long int n, m;
  while (cin >> n >> m) {
    long long int a[n + 1], b[n + 1];
    long long int sum = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      sum += a[i];
      b[i] = a[i];
    }
    long long int ct = 0;
    if (sum == m)
      cout << n << endl;
    else {
      long long int x = abs(sum - m);
      sort(a + 1, a + n + 1);
      bool ck = false;
      for (int i = 1; i <= n; i++) {
        if (m == a[i]) {
          ck = true;
          cout << 1 << endl;
          break;
        }
      }
      if (ck == false) {
        for (int i = 1; i <= n; i++) {
          if (sum < m) {
            a[i] += x;
            sum += x;
          } else if (a[i] > m) {
            sum -= a[i];
            a[i] = 0;
          } else if (sum > m) {
            a[i] -= x;
            sum -= x;
          }
        }
        long long int ct = 0;
        for (int i = 1; i <= n; i++) {
          if (a[i] == b[i]) ct++;
        }
        cout << ct << endl;
      }
    }
  }
  return 0;
}
