#include <bits/stdc++.h>
using namespace std;
const int SZ = 200005;
long long arr[SZ];
int n;
bool myf(int a, int b) { return a > b; }
long long can(int x) {
  int p = 0;
  long long ans = 0LL;
  while (p * x < n) {
    for (int i = 0; i < x; i++) {
      int xx = p * x + i;
      if (xx >= n || arr[xx] - (long long)p <= 0LL) return ans;
      ans += max(arr[xx] - (long long)p, 0LL);
    }
    p++;
  }
  return ans;
}
int main(void) {
  long long m;
  scanf("%d %lld", &n, &m);
  for (int i = 0; i < n; i++) scanf("%lld", &arr[i]);
  sort(arr, arr + n, myf);
  int l = 1, r = n;
  int ans = n + 1;
  while (l <= r) {
    int x = (l + r) / 2;
    if (can(x) >= m) {
      r = x - 1;
      ans = min(ans, x);
    } else
      l = x + 1;
  }
  if (ans == n + 1)
    printf("-1");
  else
    printf("%d", ans);
  return 0;
}
