#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int x;
  int rest = 0;
  int ans = 0;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    if (x <= rest)
      rest -= x;
    else {
      rest = m - x;
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}
