#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, cnt = 1, s = 0;
  cin >> n >> m;
  vector<int> v(n);
  vector<pair<int, int>> VP;
  for (int i = 0; i < n; i++) cin >> v[i];
  while (!v.empty()) {
    s += v[0];
    if (s <= m) {
      VP.push_back({cnt, v[0]});
      v.erase(v.begin());
    } else {
      s = 0;
      cnt++;
    }
  }
  cout << cnt << endl;
}
