n,l=input().split()
n=int(n)
l=int(l)
a=[int(x) for x in input().split()]
for i in range(1,n):
	if (a[i]>2*a[i-1]):
		a[i]=2*a[i-1]
for i in range(n,31):
	a.append(2*a[i-1])
ans=0
while (l>0):
	bl=bin(l)[2:]
	lb=len(bl)
	if (min(a[lb:])<=a[lb-1]):
		ans+=min(a[lb:])
		break
	ans+=a[lb-1]
	l-=pow(2,lb-1)
print(ans)