#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long arr[n + 1], i, j = 0, l;
  for (i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  arr[n] = 0;
  long long cary = 0, day = 0;
  long long a = k, b = k;
  for (i = 0; i < n; i++) {
    if (arr[i] != 0) {
      if (arr[i] <= k) {
        arr[i] = 0;
        if (arr[i + 1] <= k)
          arr[i + 1] = 0;
        else
          arr[i + 1] = arr[i + 1] - k;
        day++;
      } else if (arr[i] <= (2 * k)) {
        arr[i] = 0;
        day++;
      } else if (arr[i] > (2 * k)) {
        while (arr[i] > (2 * k)) {
          arr[i] = arr[i] - (2 * k);
          day++;
        }
        a = arr[i] / (2 * k);
        day += a;
        b = arr[i] % (2 * k);
        arr[i] = b;
        if (b > 0) {
          if (arr[i] <= k) {
            arr[i] = 0;
            if (arr[i + 1] <= k)
              arr[i + 1] = 0;
            else
              arr[i + 1] = arr[i + 1] - k;
            day++;
          } else if (arr[i] <= (2 * k)) {
            arr[i] = 0;
            day++;
          }
        }
      }
    }
  }
  cout << day;
  return 0;
}
