#include <bits/stdc++.h>
using namespace std;
const int dr[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
int n, m;
int a[123];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int cnt = 0;
  int id = 1;
  for (;;) {
    ++cnt;
    int rem = m;
    while (id <= n && rem >= a[id]) {
      rem -= a[id];
      ++id;
    }
    if (id > n) break;
  }
  cout << cnt << '\n';
  return 0;
}
