#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, i, aux, cont = 1;
  cin >> n >> m;
  int x[n];
  for (i = 0; i < n; i++) cin >> x[i];
  aux = x[0];
  for (i = 1; i < n; i++) {
    if (aux + x[i] <= m) {
      aux += x[i];
    } else {
      aux = x[i];
      cont++;
    }
  }
  cout << cont;
  return 0;
}
