#Solutions

#include <bits/stdc++.h>

using namespace std;

int main() {

int b,c,tmp,n,k;

int sum=0;

cin>>n>>k;

int a[n];

for(int i=0;i<n;i++)

cin>>a[i];

sort(a,a+n);

for(int i=n-1;i>=0;i-=k)

{

sum+=(a[i]-1)*2; //1st floor to n-1 floor

}

cout<<sum<<endl;

}

Advertisements