#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int maxn = 1e3 + 5;
const int maxx = 1e5 + 100;
const double EPS = 1e-7;
const int MOD = 1000000007;
template <class T>
inline T min(T a, T b, T c) {
  return min(min(a, b), c);
}
template <class T>
inline T max(T a, T b, T c) {
  return max(max(a, b), c);
}
template <class T>
inline T min(T a, T b, T c, T d) {
  return min(min(a, b), min(c, d));
}
template <class T>
inline T max(T a, T b, T c, T d) {
  return max(max(a, b), max(c, d));
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
int a[maxx];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 1; i <= n;) {
    if (a[i] <= 0) {
      i++;
      continue;
    }
    if (a[i] >= (k * 2)) {
      int cnt = a[i] / (k * 2);
      a[i] -= cnt * (k * 2);
      ans += cnt;
    } else if (a[i] > k) {
      a[i] -= (k * 2);
      ans++;
    } else if (a[i] <= k) {
      a[i] -= k;
      a[i + 1] -= k;
      ans++;
    }
  }
  cout << ans << '\n';
}
