#include <bits/stdc++.h>
int main() {
  int i, j;
  int n = 0;
  int x = 0;
  int wantSum = 0;
  int count = 0;
  int lestChiled;
  int okChildFlag;
  scanf("%d", &n);
  lestChiled = n;
  scanf("%d", &x);
  int a[n];
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    wantSum += a[i];
  }
  int min = 1000000000;
  int max = 0;
  for (i = 0; i < n; i++) {
    if (a[i] > max) max = a[i];
  }
  while (x >= max && lestChiled > 1) {
    for (i = 0; i < n; i++) {
      if (a[i] < min) {
        min = a[i];
        okChildFlag = i;
      }
    }
    x -= min;
    min = 1000000000;
    a[okChildFlag] = 1000000000;
    count++;
    lestChiled--;
  }
  if (x == max) count++;
  printf("%d\n", count);
  return 0;
}
