#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5;
const int inf = 1e9;
const int md = 1e9 + 7;
int main() {
  int n, m;
  cin >> n >> m;
  int cur = m;
  int ans = 1;
  for (int i = 0; i < n; ++i) {
    int first;
    cin >> first;
    if (first > cur) {
      ++ans;
      cur = m;
    }
    cur -= first;
  }
  cout << ans << endl;
  return 0;
}
