#include <bits/stdc++.h>
using namespace std;
const int maxn = 2010;
int dp[maxn];
int s[maxn];
int main() {
  int n, k;
  while (scanf("%d%d", &n, &k) != EOF) {
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; i++) {
      scanf("%d", &s[i]);
      dp[s[i]]++;
    }
    int sum = 0;
    sort(s, s + n);
    int top = 0;
    for (int i = 1; i < n; i++) {
      if (s[i] != s[i - 1]) {
        s[++top] = s[i];
      }
    }
    for (int j = top; j >= 0;) {
      int kk = 0;
      int i = j;
      for (; j >= 0; j--) {
        if (kk + dp[s[j]] <= k) {
          kk += dp[s[j]];
          dp[s[j]] = 0;
          continue;
        } else {
          int last = k - kk;
          dp[s[j]] -= (last);
          break;
        }
      }
      sum += s[i] * 2 - 2;
    }
    cout << sum << endl;
  }
  return 0;
}
