#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, k, r = 0, x, p = 1;
  cin >> n >> k;
  vector<int> f(n);
  for (int i = 0; i < n; i++) cin >> f[i];
  sort((f).begin(), (f).end());
  while (f.size()) {
    r += (f[0] - p) * 2 * (f.size() / k + (f.size() % k != 0));
    x = f[0];
    p = f[0];
    while (f.size() and x == f[0]) f.erase(f.begin());
  }
  cout << r;
}
