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