#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
void solve() {
  int n, m;
  scanf("%d %d", &n, &m);
  int a[MAXN];
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) scanf("%d", a + i);
  int rem = 0;
  int cnt = 0;
  for (int((i)) = (0); ((i)) < ((n)); ((i))++) {
    if (a[i] > rem) {
      cnt++;
      rem = m - a[i];
    } else
      rem -= a[i];
  }
  printf("%d", cnt);
}
int main() {
  solve();
  return 0;
}
