#include <bits/stdc++.h>
using namespace std;
long long int ara[100009];
int main() {
  long long int n, k, i, j, sum = 0, ck = 1, ck2 = 1, sum2 = 0, sum3 = 0, rem,
                            res1 = 0, res2 = 0, ans = 0;
  scanf("%lld %lld", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%lld", &ara[i]);
    if (ara[i] <= k) {
      sum = sum + 1;
      ck = 0;
    } else if (ara[i] <= k * 2) {
      sum2 = sum2 + 1;
    } else {
      sum3 = sum3 + (ara[i] / (k * 2));
      rem = ara[i] % (k * 2);
      if (rem != 0) {
        if (rem <= k) {
          res1 = res1 + 1;
          ck2 = 0;
        } else {
          res2 = res2 + 1;
        }
      }
    }
  }
  if (ck == 0 || ck2 == 0) {
    ans = ((sum + res1) / 2 + (sum + res1) % 2);
  }
  printf("%lld\n", ans + res2 + sum3 + sum2);
  return 0;
}
