#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long count = 0, s = 0;
  if (a[0] <= m) {
    s = a[0];
  } else {
    count = a[0] / m;
    s = a[0] % m;
  }
  for (long long i = 1; i < n; i++) {
    if (m - s >= a[i]) {
      s += a[i];
      if (s > 0) {
        count++;
        a[i] = 0;
      }
      s = 0;
    } else if (m - s < a[i]) {
      if (s != 0) {
        count++;
        a[i] = a[i] - (m - s);
      }
      count += a[i] / m;
      s = a[i] % m;
    }
  }
  cout << count;
}
