#include <bits/stdc++.h>
using namespace ::std;
int main() {
  int n, m, temp, total = 0, count = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    total += temp;
    if (total < m)
      continue;
    else if (total > m) {
      count++;
      total = temp;
    } else {
      count++;
      total = 0;
    }
  }
  if (total != 0) count++;
  cout << count;
  return 0;
}
