#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100;
int a[MAX_N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int(i) = 0; (i) < (n); ++(i)) cin >> a[i];
  int res = 1;
  int j = 0;
  int cur = m;
  while (j < n) {
    if (cur >= a[j]) {
      cur -= a[j];
      j++;
    } else {
      cur = m;
      res++;
    }
  }
  cout << res << endl;
  return 0;
}
