#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  int cur = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int t;
    scanf("%d", &t);
    if (cur + t > m) {
      ans++;
      cur = t;
    } else
      cur += t;
  }
  if (cur) ans++;
  cout << ans << endl;
}
