#include <bits/stdc++.h>
using namespace std;
long long k, c, a[400001], n, b, x, q, sz, l = 0, m, r = 1000;
pair<long long, long long> d[1000000];
bool us[500001];
char ch;
bool pr(long long x) {
  long long cur = 0, res = 0, w = 0;
  for (int i = n; i >= 1; i--) {
    cur++;
    if (cur > x) {
      cur = 1;
      w++;
    }
    res += max(sz, a[i] - w);
  }
  return res >= m;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  r = 10000000;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (pr(mid))
      r = mid;
    else
      l = mid;
  }
  if (pr(l) && l != 0)
    cout << l;
  else if (pr(r))
    cout << r;
  else
    cout << -1;
}
