#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m, g, s = 0, c = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> g;
    if (s + g < m) {
      s += g;
    } else if (s + g == m) {
      s = 0;
      c++;
    } else {
      s = g;
      c++;
    }
  }
  if (s != 0) c++;
  cout << c << endl;
  return 0;
}
