#include <bits/stdc++.h>
using namespace std;
vector<long long> a(1234);
long long n, m;
bool super(long long v) {
  long long t = 0;
  long long ans = 0;
  for (int i = n; i > 0; i--) {
    ans += max(0ll, (a[i] - t / v));
    t++;
  }
  return ans >= m;
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(NULL));
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a.begin(), a.begin() + n);
  long long l = 1;
  long long r = n + 1;
  while (l != r) {
    long long mid = (l + r) / 2;
    if (super(mid))
      r = mid;
    else
      l = mid + 1;
  }
  if (l >= n + 1)
    cout << "-1";
  else
    cout << l;
  return 0;
}
