#include using namespace std; #define FOR(i, n, m) for (int i = n; i < (int)m; ++i) #define REP(i, n) FOR(i, 0, n) #define REP_1(i, n) for (int i = 1; i <= (int)n; ++i) #define RFOR(i, n, m) for (int i = (int)n - 1; i >= (int)m; --i) #define RREP(i, n) RFOR(i, n, 0) #define RREP_1(i, n) for (int i = (int)n; i >= 1; --i) #define ALL(v) v.begin(), v.end() #define RALL(v) v.rbegin(), v.rend() #define SIZE(v) (int)v.size() #define EMPTY(v) v.empty() #define SORT(v) sort(ALL(v)) #define RSORT(v) sort(RALL(v)) #define REVERSE(v) reverse(ALL(v)) #define UNIQUE(v) (SORT(v), v.erase(unique(ALL(v)), v.end())) #define PB push_back #define EB emplace_back #define MP make_pair #define YES() cout << "YES\n" #define NO() cout << "NO\n" #define Yes() cout << "Yes\n" #define No() cout << "No\n" #define YESNO(cond) cout << ((cond) ? "YES" : "NO") << '\n' #define YesNo(cond) cout << ((cond) ? "Yes" : "No") << '\n' #define IN(x, a, b) ((a) <= (x) && (x) < (b)) #define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b)) #define FASTIO() \ ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) #define PRECISION(n) cout << fixed << setprecision(n) using P = pair; using ll = long long; using ull = unsigned long long; using ld = long double; template using min_queue = priority_queue, greater>; template using max_queue = priority_queue; constexpr ll INF = 1000000000; constexpr ll INFL = (ll)1000000000000001000LL; constexpr ll MOD = 998244353; constexpr ld PI = 3.141592653589793238462643383279; constexpr ld EPS = 1e-9; void solve() { int n, s; cin >> n >> s; vector a(n); REP(i, n) cin >> a[i]; RSORT(a); int ng = 1, ok = INF; while (ok - ng > 1) { int t = (ok + ng) / 2; int rem = s; for (int i = 0; i < n; i += t) { if (a[i] <= t) break; rem -= a[i]; } if (rem > 0) ok = t; else ng = t; } cout << ok << endl; } int main() { FASTIO(); int t = 1; // cin >> t; while (t--) { solve(); } }