#include <bits/stdc++.h>
using namespace std;
int ans = 0, a[20005], k;
void recurse(int start, int end) {
  int times, j, i, p;
  if (end < start)
    return;
  else {
    times = ((end - start + 1) / k);
    if (((end - start + 1) % k)) {
      times += 1;
    }
    ans += ((times - 1) * 2 * a[start]) + a[start];
    p = a[start];
    j = start;
    for (i = start; i <= end; i++) {
      a[i] -= p;
      if (a[i] == 0) j++;
    }
    recurse(j, end);
  }
}
int main() {
  int n, i;
  cin >> n >> k;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    a[i] -= 1;
  }
  sort(a, a + n);
  ans = a[n - 1];
  recurse(0, n - 1);
  cout << ans << endl;
  return 0;
}
