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