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