#include <bits/stdc++.h>
using namespace std;
int main() {
  long long m, n;
  cin >> n >> m;
  long long ip;
  vector<long long> v;
  for (long long i = 0; i < n; i++) {
    cin >> ip;
    v.push_back(ip);
  }
  long long people = 0, cnt = 1;
  for (long long i = 0; i < n; i++) {
    if (people + v[i] <= m)
      people += v[i];
    else {
      cnt++;
      people = v[i];
    }
  }
  cout << cnt;
  return 0;
}
