#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, ans = 0, m = 0;
  cin >> n >> k;
  pair<long long, long long> a[n];
  for (int i = 0; i < n; i++) cin >> a[i].first;
  for (int i = 0; i < n - 1; i++) {
    if (a[i].second != 0) {
      ans += ceil(
          (double)(a[i].second + min(a[i].first, abs(a[i].second - k))) / k);
      a[i].first -= min(a[i].first, abs(a[i].second - k));
      a[i].second = 0;
    }
    if (a[i].first >= k) {
      ans += a[i].first / k;
      a[i].first %= k;
    }
    a[i + 1].second = a[i].first;
  }
  ans += ceil((double)(a[n - 1].first + a[n - 1].second) / k);
  cout << ans;
}
