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