#include <bits/stdc++.h>
int main() {
  int n, m, bus = 0;
  int cad[1000], current;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &cad[i]);
  }
  current = 0;
  for (int i = 0; i < n; i++) {
    if (current + cad[i] <= m) {
      if (current + cad[i] == m) {
        bus++;
        current = 0;
      } else {
        current = current + cad[i];
        if (i == n - 1) {
          bus++;
        }
      }
    } else {
      bus++;
      i--;
      current = 0;
    }
  }
  printf("%d", bus);
  return 0;
}
