#include <bits/stdc++.h>
using namespace std;
int compare(const void *a, const void *b) {
  int *p = (int *)a;
  int *q = (int *)b;
  if (p[0] == q[0]) return p[1] - q[1];
  return p[0] - q[0];
}
int main() {
  int n, m, c = 0, t, i, x;
  scanf("%d%d", &n, &m);
  ;
  t = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &x);
    ;
    if (x > t) {
      c++;
      t = m - x;
    } else
      t -= x;
  }
  printf("%d\n", c);
  return 0;
}
