#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int n, m;
  vector<int> a(n);
  cin >> n >> m;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  int cur = 0;
  int ans = 1;
  for (long long i = 0; i < n; ++i) {
    cur += a[i];
    if (cur > m) {
      cur = a[i];
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
