#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int buses = 0, capacity = 0;
  for (int i = 0; i < n; i++) {
    int ppl;
    cin >> ppl;
    if (ppl > capacity) {
      buses++;
      capacity = m;
      capacity -= ppl;
    } else {
      capacity -= ppl;
    }
  }
  cout << buses;
  return 0;
}
