#include <bits/stdc++.h>
struct data {
  int checked;
  int num;
};
int main(void) {
  int happy_num = 0;
  int N, x;
  struct data okasi[101];
  scanf("%d %d", &N, &x);
  for (int i = 0; i < N; i++) {
    scanf("%d", &okasi[i].num);
    okasi[i].checked = 0;
  }
  while (true) {
    int min;
    int min_num;
    int fin = 0;
    for (int i = 0; i < N; i++) {
      if (okasi[i].checked == 0) {
        min = okasi[i].num;
        min_num = i;
        fin = 1;
        break;
      }
    }
    for (int i = 0; i < N; i++) {
      if (okasi[i].checked == 0 && min > okasi[i].num) {
        min = okasi[i].num;
        min_num = i;
      }
    }
    okasi[min_num].checked = 1;
    if (x < min || fin == 0) {
      if (x != 0 && happy_num > 0) happy_num -= 1;
      printf("%d\n", happy_num);
      break;
    } else {
      x = x - min;
      happy_num++;
    }
  }
  return 0;
}
