#include <bits/stdc++.h>
void swap(int *num1, int *num2) {
  int temp = *num1;
  *num1 = *num2;
  *num2 = temp;
}
void SortByNumber(int *a, int n) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n - 1 - i; j++) {
      if (a[j] < a[j + 1]) {
        swap(&a[j], &a[j + 1]);
      }
    }
  }
}
int main() {
  int numberUSB;
  scanf("%d", &numberUSB);
  int sizeFile;
  scanf("%d", &sizeFile);
  int ukuranUSB[101];
  int count = 0;
  for (int i = 0; i < numberUSB; i++) {
    scanf("%d", &ukuranUSB[i]);
  }
  SortByNumber(ukuranUSB, numberUSB);
  int sum = 0;
  for (int j = 0; j < numberUSB; j++) {
    sum += ukuranUSB[j];
    if (sum >= sizeFile) {
      count++;
      break;
    }
    count++;
  }
  printf("%d", count);
  return 0;
}
