#include <bits/stdc++.h>
using namespace std;
int n, m, arr[101], ans;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  while (m > 0 && n - 1 - ans >= 0) {
    m -= arr[n - 1 - ans++];
  }
  if (m > 0) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
  return 0;
}
