#include <bits/stdc++.h>
int main() {
  int i, j, n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    int sum = 0;
    int ans = 0;
    for (i = 0; i < n; i++) {
      int num;
      scanf("%d", &num);
      sum += num;
      if (sum > m) {
        ans++;
        sum = num;
      }
    }
    if (sum) ans++;
    printf("%d\n", ans);
  }
}
