#include using namespace std; typedef long long ll; typedef pair P; #define REP(i,n) for(int i=0;i=x) continue; else{ ll k=(x-a[i]-c+i-1)/i; if(K-k>=0){ K-=k; c+=k*i; } else return false; } } return true; } int main(void){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll i,j,k; cin >> N >> KK; for(i=1;i<=N;i++) cin >> a[i]; ll ok=-1,ng=1e15; while(ng-ok>1){ ll mid=(ok+ng)/2; if(check(mid)) ok=mid; else ng=mid; } cout << ok << endl; return 0; }