#include <bits/stdc++.h>
using namespace std;
class Puzzle {
 public:
  int N, x;
  map<int, int> As;
  void input() {
    cin >> N >> x;
    int a;
    for (int ni = 0; ni < N; ni++) {
      cin >> a;
      if (As.count(a) == 0) {
        As[a] = 1;
      } else {
        As[a]++;
      }
    }
  }
  void play() {
    int ans = 0;
    int cnt = 0;
    int remain = x;
    for (auto a : As) {
      if (a.first * a.second <= remain) {
        ans += a.second;
        remain -= a.first * a.second;
      } else {
        ans += remain / a.first;
        break;
      }
    }
    if (remain > 0) ans--;
    cout << ans;
    return;
  }
};
int main() {
  Puzzle puz;
  puz.input();
  puz.play();
  return 0;
}
