#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
vector<int> non(vector<int> in) {
  vector<int> ans;
  for (int i = 0; i < ((int)(in.size())); i++)
    if (in[i]) ans.push_back(in[i]);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n, cap;
  cin >> n >> cap;
  vector<int> in(n, 0);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> in[i];
    in[i]--;
    mx = max(mx, in[i]);
  }
  sort(in.begin(), in.end());
  int ans = 0;
  while (((int)(in.size()))) {
    int mn = in[0];
    int all = ((int)(in.size()));
    int trip = (all + cap - 1) / cap;
    ans += mn * 2 * trip;
    for (int i = 0; i < all; i++) in[i] -= mn;
    in = non(in);
  }
  cout << ans << endl;
  return 0;
}
