#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum == m) {
    cout << n;
    return;
  } else if (sum < m) {
    cout << "-1";
    return;
  }
  sort(a.rbegin(), a.rend());
  int i = 0, days = n + 3;
  sum = 0;
  for (int k = 1; k <= n; k++) {
    sum = 0;
    for (int i = 0; i < n; i++) sum += (max(0, a[i] - (i / k)));
    if (sum >= m) days = min(k, days);
  }
  cout << days;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  solve();
  cerr << "Time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}
