#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int b = 0, k, l;
  l = m;
  while (n--) {
    cin >> k;
    if (l + k > m) {
      b++;
      l = k;
    } else {
      l += k;
    }
  }
  cout << b << endl;
  return 0;
}
