#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
int main() {
  int n;
  long long int k;
  cin >> n >> k;
  int ar[n + 5];
  for (int i = 0; i < n; i++) cin >> ar[i];
  long long int a1 = k, b = k, f = 0, cnt = 0;
  sort(ar, ar + n, greater<int>());
  for (int i = 0; i < n; i++) {
    a1 = k;
    b = k;
    if (ar[i] <= 0) continue;
    if (f == 1) {
      ar[i] -= k;
      f = 0;
    }
    if (ar[i] <= 0)
      continue;
    else if (ar[i] <= k) {
      a1 = 0;
      cnt++;
      f = 1;
    } else if (ar[i] <= (2 * k)) {
      a1 = 0, b = 0;
      cnt++;
      f = 0;
    } else {
      cnt += ar[i] / (2 * k);
      if (ar[i] % (2 * k) != 0) {
        long long int r = ar[i] % (2 * k);
        if (r <= k) {
          a1 = 0;
          cnt++;
          f = 1;
        } else if (r <= (2 * k)) {
          a1 = 0, b = 0;
          cnt++;
          f = 0;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
