#include <bits/stdc++.h>
using namespace std;
const int mr = 10000000;
bool notp[mr];
int pr[670000], pn, ans;
void getprime() {
  pn = 0;
  memset(notp, 0, sizeof(notp));
  for (int i = 2; i < mr; i++) {
    if (!notp[i]) pr[pn++] = i;
    for (int j = 0; j < pn && pr[j] * i < mr; j++) {
      notp[pr[j] * i] = 1;
      if (i % pr[j] == 0) break;
    }
  }
}
int x[20000], a[20000];
int main() {
  memset(x, 0, sizeof(x));
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    x[i] = 1;
  }
  int sum = 0;
  int now = 1;
  int last = 1;
  while (1) {
    int ft = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] != x[i] && x[i] < now) {
        ft++;
        x[i] = now;
      }
    }
    int p = (ft + k - 1) / k;
    sum += (p + p - 1) * (now - last);
    last = now;
    for (int i = 0; i < n; ++i) {
      if (a[i] > now) {
        now = a[i];
        break;
      }
    }
    if (now == last) break;
  }
  sum += now - 1;
  printf("%d\n", sum);
}
