#include <bits/stdc++.h>
using namespace std;
int n, m, a[111];
int main() {
  scanf("%d%d", &n, &m);
  int ans = 0;
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int left = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > left) {
      left = m - a[i];
      ans++;
    } else {
      left -= a[i];
    }
  }
  printf("%d\n", ans);
  return 0;
}
