#include <bits/stdc++.h>
using namespace std;
int sum[2010];
int main() {
  int i, n, k, j, m, ans, tk;
  while (~scanf("%d%d", &n, &k)) {
    memset(sum, 0, sizeof(sum));
    for (i = 1; i <= n; i++) {
      scanf("%d", &m);
      sum[m]++;
    }
    ans = 0;
    i = 2000;
    while (true) {
      while (i > 0 && sum[i] == 0) i--;
      if (i <= 1) break;
      m = i;
      tk = k;
      while (i > 0 && tk >= sum[i]) {
        tk -= sum[i];
        sum[i] = 0;
        i--;
      }
      if (i > 0 && sum[i] > tk) sum[i] -= tk;
      ans += 2 * (m - 1);
    }
    printf("%d\n", ans);
  }
  return 0;
}
