#include <bits/stdc++.h>
using namespace std;
int main() {
  int groups, capacity, buses, left, group;
  cin >> groups >> capacity;
  buses = 0;
  left = capacity;
  for (int i = 0; i < groups; i++) {
    cin >> group;
    if (left >= group) {
      left -= group;
    } else {
      buses++;
      left = capacity - group;
    }
  }
  cout << ((left == capacity) ? buses : buses + 1) << endl;
  return 0;
}
