#include <bits/stdc++.h>
using namespace std;
int s[1005], oo[1005];
int cmp(int p, int q) { return p > q; }
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  for (int i = 1; i <= a; i++) scanf("%d", &s[i]);
  sort(s + 1, s + 1 + a, cmp);
  int l = 1, r = a, flag = 0;
  while (l <= r) {
    int mid = (l + r) >> 1;
    for (int i = 0; i <= a; i++) oo[i] = 0;
    int pp = 0, ans = 0;
    while (1) {
      for (int i = 1; i <= mid; i++) {
        if (pp == a + 1) break;
        if (s[++pp] - oo[i] > 0)
          ans += (s[pp] - oo[i]), oo[i]++;
        else
          break;
      }
      if (pp == a + 1 || ans >= b) break;
    }
    if (ans >= b)
      flag = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  if (flag)
    printf("%d\n", flag);
  else
    printf("-1\n");
  return 0;
}
