#include <bits/stdc++.h>
using namespace std;
int a[5005], b, c, d, e, f, g, h, i, j, k, l, m, n;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  for (i = n; i > 0; i -= m) h += (a[i] - 1) * 2;
  printf("%d", h);
  return 0;
}
