#include <bits/stdc++.h>
using namespace std;
long long int fact[200003];
void init() {
  fact[0] = 1;
  for (int i = 1; i < 200003; i++) {
    fact[i] = (fact[i - 1] * i) % 1000000007;
  }
}
long long int modpow(long long int x, long long int n) {
  if (n == 0) return 1;
  long long int v = ((x % 1000000007) * (x % 1000000007)) % 1000000007;
  if (n % 2 == 0) return modpow(v, n / 2);
  return (x * modpow(v, (n - 1) / 2)) % 1000000007;
}
long long int invmod(long long int a) { return modpow(a, 1000000007 - 2); }
long long int ncr(long long int n, long long int r) {
  return (((fact[n] * invmod(fact[r])) % 1000000007) * invmod(fact[n - r])) %
         1000000007;
}
int n, k, a[1000004];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  double days = 0;
  for (int i = 0; i < n; i++) {
    days += (a[i] / (2 * k));
    if (a[i] % (2 * k) > k) {
      days++;
    } else if (a[i] % (2 * k) > 0) {
      days += 0.5;
    }
  }
  cout << (long long int)(days + 0.5);
}
