import heapq
n,X=map(int,input().split())
v=list(map(int,input().split()))
rv=v.copy()
a=list(map(int,input().split()))
nk=[]
he=[]
dw={}
for i in range(len(v)):
    nk.append(1)
    heapq.heappush(he,-v[i])
    dw[v[i]]=i
sum=0
for i in range(X):
    now=-heapq.heappop(he)
    v[dw[now]]=rv[dw[now]]//(nk[dw[now]]+1)
    nk[dw[now]]+=1
    heapq.heappush(he,-v[dw[now]])
    sum+=now
print(sum)
    
    






# a=[1,99,6,5,4,2,33,8,7,5,2,4]
# b=[]
# for i in a:
#     heapq.heappush(b,i)
    
# for i in a:
#     print(heapq.heappop(b))
# print(b)