#include <bits/stdc++.h>
using namespace std;
bool func(long long a, long long b) {
  if (a == 0) return false;
  return a < b;
}
int main() {
  int n, m;
  int x, y;
  cin >> n >> m;
  int v[1005];
  for (int i = 0; i < n; i++) cin >> v[i];
  int ans = 0;
  for (int i = 0; i < n;) {
    int left = m;
    ans++;
    while ((left >= v[i]) && (i < n)) {
      left -= v[i];
      i++;
    }
  }
  cout << ans;
}
