#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int a[N], sum[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]), a[i]--;
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  int tot = 0, now = 0;
  long long ans = 0ll;
  for (int i = 1; i <= n; ++i) {
    if (!tot) {
      now = a[i];
      ans += a[i];
    }
    tot++;
    if (tot == k || i == n) {
      ans += now;
      tot = 0;
      now = 0;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
