import math
tmp = input().split(" ")
n = int(tmp[0])
k = int(tmp[1])
a = input().split(" ")
b = [0]*n
for i in range(0,n):
b[i] = int(a[i])
suma = 0
for i in range(0,n):
suma += int(a[i])
ans = (-1 + math.sqrt(1 - 4*(-2*k/suma) ))/2
for i in range(0,n):
a[i] = int(ans) * b[i] + int(a[i])
if(ans-int(ans) == 0):
print(int(ans)*n)
exit()
k -= suma * int(ans)
if(int(ans) % 2 == 0):
ans = int(ans) * n
for i in range(n-1,0,-1):
if(k >= int(a[i])):
k -= int(a[i])
ans +=1
else:
ans = int(ans) * n
for i in range(n-1,0,-1):
if(k >= int(a[i])):
k -= int(a[i])
a[i] = str(int(b[i]) + int(a[i]))
ans +=1
print(int(ans))
Copy