#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<int> caffeine(n);
  for (int i = 0; i < n; i++) {
    cin >> caffeine[i];
  }
  sort(caffeine.begin(), caffeine.end(), greater<long long>());
  long long total_sum = 0, sum = 0;
  for (int i = 0; i < n; i++) {
    sum += max(caffeine[i] - i, 0);
    total_sum += caffeine[i];
  }
  if (total_sum < m) {
    cout << -1 << endl;
  } else if (total_sum == m) {
    cout << n << endl;
  } else {
    vector<int> d;
    for (int i = 0; i < 100; i++) {
      int k = 0, sum1 = 0;
      int j = 0;
      while (j < n) {
        for (int m = 0; m <= i; m++) {
          sum1 += max(caffeine[j] - k, 0);
          j++;
          if (j >= n) {
            break;
          }
        }
        k++;
        if (sum1 >= total_sum) {
          break;
        }
      }
      d.push_back(sum1);
      if (sum1 >= total_sum) {
        break;
      }
    }
    int i = 0;
    while (d[i] < m) {
      i++;
    }
    cout << i + 1 << endl;
  }
}
