#include <bits/stdc++.h>
using namespace std;
int a[200001];
int main() {
  int n, k;
  cin >> n;
  cin >> k;
  int sum = 0, left = 0, d = 0, load = 0, t = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum = sum + a[i];
    if (sum >= k) {
      if (t == 0) {
        left = sum - sum / k * k;
        d = sum / k + d;
        sum = left;
      } else {
        sum = sum - load;
        d++;
        left = sum - sum / k * k;
        d = sum / k + d;
        sum = left;
      }
    } else {
      if (t == 0) {
        load = k - sum;
        t++;
      } else {
        if (load >= sum) {
          load = 0;
          t = 0;
          d++;
        } else {
          load = sum - load;
          t = 1;
          d++;
        }
      }
    }
    if (i == n - 1 && left != 0) {
      d += 1;
    }
  }
  cout << d;
  return 0;
}
