n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
S=[[] for _ in range(k)]
j=0
for i in range(n):
   S[j].append(A[i])
   j+=1
   j=j%k
z=0
for i in range(k):
    z+=len(S[i])+S[i][0]
print(z)
