#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int buses = 0;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    int c = m;
    int j = i;
    while (c - a[i] >= 0 && i < n) {
      c -= a[i];
      j = i;
      i++;
    }
    i = j;
    buses++;
  }
  cout << buses;
}
