func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class A>   ostream& operator<<(ostream& out, const vector<A>& v) {     for (long long i = 0; i < v.size(); i++) {       if (i) out <<    ;       out << v[i];     }     return out <<   n ;   }   const long long mod = 1000000007;   inline long long add(long long a, long long b) {     a += b;     if (a >= mod) a -= mod;     return a;   }   inline long long sub(long long a, long long b) {     a -= b;     if (a < 0) a += mod;     return a;   }   inline long long mul(long long a, long long b) { return (a * 1ll * b) % mod; }   inline long long powmod(long long a, long long b) {     long long rt = 1;     while (b > 0) {       if (b & 1) rt = mul(rt, a);       a = mul(a, a);       b >>= 1;     }     return rt;   }   inline long long inv(long long a) { return powmod(a, mod - 2); }   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   long long n, k;   long long a[100005];   bool check(long long mid) {     long long sum = 0;     for (long long i = 0; i < n; i++) {       sum += min(mid, a[i]);     }     return sum <= k;   }   void solve() {     cin >> n >> k;     long long rt = 0;     for (long long i = 0; i < n; i++) {       cin >> a[i];       rt += a[i];     }     if (rt < k) {       cout << -1 <<   n ;       return;     }     long long lo = 1;     long long hi = *max_element(a, a + n);     long long ans = 0;     while (hi - lo >= 0) {       long long mid = (hi + lo) >> 1;       if (check(mid)) {         lo = mid + 1;         ans = mid;       } else {         hi = mid - 1;       }     }     if (false) cerr << ans <<   n ;     for (long long i = 0; i < n; i++) {       k -= min(a[i], ans);       a[i] -= min(a[i], ans);     }     if (false) cerr << k <<   n ;     long long i = 0;     for (i = 0; i < n && k > 0; i++) {       if (a[i] <= 0)         continue;       else {         a[i]--;         k--;       }       if (false) cerr << a[i] <<    ;     }     if (false) cerr <<   n ;     long long y = 0;     for (long long j = i; j < i + n; j++) {       long long tmp = j % n;       if (false) cerr << a[tmp] <<    ;       if (a[tmp] <= 0) continue;       y = 1;       cout << tmp + 1 <<    ;     }     cout <<   n ;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL),         cout << setprecision(14);     ;     long long t = 1;     while (t--) {       solve();     }   }   