#include <iostream>
#include <string>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <stack>
#include <bitset>
#define pb push_back
using namespace std;
void compile(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int main(){
compile();
int t = 1;
//cin >> t;
while(t--){
int n, k;
scanf("%d%d",&n,&k);
int a[n];
unsigned long long sum = 0;
for(int i = 0 ; i < n ; i++){
scanf("%d",a+i);
sum += a[i];
}
unsigned long long l = 0, r = 1e15, mid, mx = 0;
while(l <= r){
mid = l + (r - l) / 2;
if(sum * ((mid + 1) * mid) / 2 < k){
l = mid + 1;
mx = max(mx, mid);
}
else if(sum * ((mid + 1) * mid) / 2 > k){
r = mid - 1;
}
else{
cout<<mid * n<<endl;
return 0;
}
}
unsigned long long cnt = 0, mxx = (mx * (mx + 1)) / 2;
sum = 0;
if(mid % 2){
for(int i = n - 1 ; i >= 0 ; i--){
sum += ((unsigned long long)(mx + 1) * a[i]);
if(sum + mxx > k)break;
cnt++;
}
}
else{
for(int i = 0 ; i < n ; i++){
sum += ((unsigned long long)(mx + 1) * a[i]);
if(sum + mxx > k)break;
cnt++;
}
}
unsigned long long ans = cnt + mx;
cout<<ans<<endl;
}
}
Copy