#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int N = 2e5 + 7;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
int n;
bool ck(int a) {
  for (int i = 2; i * i <= a; ++i) {
    if (a % i == 0) return 1;
  }
  return 0;
}
int main() {
  vector<int> I;
  int k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    --t;
    I.push_back(t);
  }
  sort(I.begin(), I.end());
  int res = 0;
  for (int i = n % k ? (n % k) - 1 : k - 1;; i += k) {
    if (i > n - 1) i = n - 1;
    res += I[i] * 2;
    if (i == n - 1) break;
  }
  cout << res << endl;
}
