#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s, i, k = 0, a, m;
  cin >> n >> m;
  s = m;
  for (i = 1; i <= n; i++) {
    cin >> a;
    if (a > s) {
      s = m - a;
      k++;
    } else
      s -= a;
  }
  if (s != m) k++;
  cout << k;
  return 0;
}
