#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, sum = 0, s = 0;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (sum + a[i] > m) {
      sum = 0;
      s++;
      i--;
    } else
      sum += a[i];
  }
  if (sum != 0) s++;
  cout << s;
  return 0;
}
