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