#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, i, j, a[100010], s = 0, t;
  scanf("%d %d", &n, &k);
  t = 2 * k;
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s += a[i] / t;
    a[i] %= t;
    if (a[i] > k) {
      a[i] = 0;
      s++;
    }
  }
  for (i = 0; i < n; i++) {
    if (a[i] <= 0) continue;
    if (a[i] > 0) {
      s++;
      for (j = i + 1; j < n; j++)
        if (a[j] > 0) {
          a[j] -= k;
          break;
        }
    }
  }
  cout << s << endl;
  return 0;
}
