#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, t;
vector<int> a;
bool poss(int d) {
  long long su = 0;
  for (int i = a.size() - 1; i >= 0; i--) {
    int dec = (a.size() - i - 1) / d;
    int q = a[i] - dec;
    if (q > 0)
      su += q;
    else
      break;
  }
  return (su >= (long long)m);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> t;
    a.push_back(t);
  }
  sort(a.begin(), a.end());
  int i = 1, j = n, mid;
  while (j - i > 1) {
    mid = (i + j) >> 1;
    if (poss(mid))
      j = mid;
    else
      i = mid + 1;
  }
  int sol = -1;
  if (poss(i))
    sol = i;
  else if (poss(j))
    sol = j;
  cout << sol << endl;
}
