#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2222;
;
int n, k, dp[maxn], num[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  int sn = n;
  for (int i = 0; i < n; i++) cin >> num[i];
  sort(num, num + n);
  int p = 0, pr = 1, ans = 0, cnt = 0;
  while (p < sn) {
    cnt++;
    while (p < sn && num[p] == num[p + 1]) {
      p++;
      cnt++;
    }
    ans += 2 * ((n + k - 1) / k) * (num[p] - pr);
    pr = num[p];
    n = sn - cnt;
    p++;
  }
  cout << ans;
}
