#include <bits/stdc++.h>
using namespace std;
long long INF = (1e19);
int n, m;
int a[105];
bool cmp(int a, int b) { return a > b; }
bool check(int d) {
  int i = 1, k = 0, ans = 0;
  while (a[i] - k > 0 && i <= n) {
    ans += (a[i] - k);
    if (i % d == 0) {
      k++;
    }
    if (ans >= m) {
      return true;
    }
    i++;
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ans += a[i];
  }
  if (ans < m) {
    printf("-1");
  } else {
    sort(a + 1, a + 1 + n, cmp);
    int l = 1, r = n, p;
    while (l <= r) {
      int mid = (l + r) / 2;
      if (check(mid)) {
        r = mid - 1;
        p = mid;
      } else {
        l = mid + 1;
      }
    }
    printf("%d\n", p);
  }
  return 0;
}
