#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a, T b) {
  for (; a != b; a++) cerr << *a << ' ';
  cerr << endl;
}
template <class T>
bool isprime(T x) {
  int till = (T)sqrt(x + .0);
  if (x <= 1) return 0;
  if (x == 2) return 1;
  if (x / 2 * 2 == x) return 0;
  for (int i = 3; i <= till; i += 2)
    if (x / i * i == x) return 0;
  return 1;
}
int n, k;
int f[100010];
int main() {
  cin >> n;
  cin >> k;
  for (int i = 0; i < n; i++) cin >> f[i];
  sort(f, f + n);
  int res = 1e9;
  for (int i = 0; i < k; i++) {
    int cur = 0, x;
    for (x = i; x < n; x += k) cur += 2 * f[x] - 2;
    if (x != n - 1 + k) cur += 2 * f[n - 1] - 2;
    res = min(cur, res);
  }
  cout << res;
  return EXIT_SUCCESS;
}
