#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
const double inf = ~0u >> 2;
int a[110];
int main() {
  int n, m, i, j;
  cin >> n >> m;
  int ans = 1;
  int k = m;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= n; i++) {
    if (a[i] <= k) {
      k -= a[i];
    } else {
      ans++;
      k = m - a[i];
    }
  }
  cout << ans << endl;
  return 0;
}
