#include <bits/stdc++.h>
int A[100001];
int main(void) {
  using namespace std;
  ios_base::sync_with_stdio(false);
  int N, K, count = 0;
  cin >> N >> K;
  int twice_K = 2 * K;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (A[i] > twice_K) {
      count += A[i] / twice_K;
      A[i] = A[i] % twice_K;
    }
  }
  int count2 = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] > K) {
      ++count;
      A[i] = -1;
    } else if (A[i] != 0) {
      ++count2;
    }
  }
  if (count2 % 2 == 0)
    count += count2 / 2;
  else
    count += count2 / 2 + 1;
  cout << count << '\n';
}
