#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> f(n);
  for (int i = 0; i < n; i++) {
    cin >> f[i];
  }
  sort(f.begin(), f.end(), greater<int>());
  int tek = 1;
  int sek2 = 0;
  int i = 0;
  while (i < n) {
    int j = 0;
    while (j < k && i < n) {
      sek2 = sek2 + abs(f[i] - tek);
      tek = f[i];
      j++;
      i++;
    }
    j = 0;
    i--;
    if (i < n) {
      sek2 = sek2 + abs(f[i] - 1);
      tek = 1;
      i++;
    }
  }
  cout << sek2;
}
