#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a[100005], cnt = 0, i, j, k, t, res = 0, cnt1 = 0, cnt2 = 0;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    if (a[i] <= k) {
      cnt1++;
    } else {
      t = a[i] / (2 * k);
      if (t == 0)
        cnt2++;
      else {
        cnt2 = cnt2 + a[i] / (2 * k);
        t = a[i] % (2 * k);
        if (t != 0) {
          if (t <= k)
            cnt1++;
          else
            cnt2++;
        }
      }
    }
  }
  res = cnt2 + (cnt1 + 1) / 2;
  cout << res;
  return 0;
}
