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