#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e12;
const long long mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  vector<long long> arr(n);
  long long t = 0;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    t += arr[i];
  }
  if (t < m) {
    cout << -1 << endl;
    return 0;
  }
  sort(arr.begin(), arr.end());
  t = 0;
  for (long long i = 0; i < n; i++) {
    t += arr[n - i - 1];
    long long second = t;
    long long pen = 1;
    long long cnt = 0;
    for (int j = n - i - 2; j >= 0; j--) {
      second += max(0LL, arr[j] - pen);
      cnt += 1;
      if (cnt == (i + 1)) {
        pen += 1;
        cnt = 0;
      }
    }
    if (second >= m) {
      cout << i + 1 << endl;
      return 0;
    }
  }
}
