#include <bits/stdc++.h>
using namespace std;
int last = 0, ans = 0;
int main() {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    if (a <= last)
      last -= a;
    else
      ans += 1, last = M - a;
  }
  cout << ans << endl;
  return 0;
}
