#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long m;
  cin >> n >> m;
  long long sum = 0;
  long long res = 0;
  long long x;
  stack<long long> Stack;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &x);
    if (!Stack.size()) {
      res += x / m;
      x = x % m;
      if (x != 0) Stack.push(x);
    } else {
      if (Stack.top() + x < m) {
        res++;
        Stack.pop();
      } else {
        res += (Stack.top() + x) / m;
        x = (Stack.top() + x) % m;
        Stack.pop();
        if (x) Stack.push(x);
      }
    }
  }
  cout << res + (Stack.size() != 0) << endl;
  return 0;
}
