#include <bits/stdc++.h>
using namespace std;
int main() {
  int g, n, co = 1, x, y;
  cin >> g >> n;
  y = n;
  for (int i = 0; i < g; ++i) {
    cin >> x;
    if (x <= y) {
      y -= x;
    } else {
      co++;
      y = n - x;
    }
  }
  cout << co;
  return 0;
}
