#include <bits/stdc++.h>
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a[n];
  int i, j;
  int sum = 0, count = 0;
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) {
    sum = sum + a[i];
    if (sum + a[i + 1] > m) {
      count++;
      sum = 0;
    }
  }
  printf("%d", count);
  return 0;
}
