#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long i = 0, buf = 0, ans = 0, f = 0;
  while (i < n) {
    if (buf + a[i] <= m) {
      if (f == 0) {
        ans++;
        f = 1;
      }
      buf += a[i];
      i++;
    } else {
      f = 0;
      buf = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
