#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T maxi(T a, T b) {
  return a > b ? a : b;
}
template <typename T>
inline T mini(T a, T b) {
  return a < b ? a : b;
}
template <typename T>
inline T absl(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T gcd(T a, T b) {
  T t;
  if (a < b) {
    while (a) {
      t = a;
      a = b % a;
      b = t;
    }
    return b;
  } else {
    while (b) {
      t = b;
      b = a % b;
      a = t;
    }
    return a;
  }
}
int solve(vector<int> a, int d, int n) {
  int sum = 0;
  for (int i = 1; i <= n; ++i) {
    sum += maxi(0, (a[i - 1] - ((i - 1) / d)));
  }
  return sum;
}
void input() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end(), greater<int>());
  for (int d = 1; d <= n; ++d) {
    if (solve(a, d, n) >= m) {
      cout << d << endl;
      return;
    }
  }
  cout << -1 << endl;
}
int main() {
  input();
  return 0;
}
