#include <bits/stdc++.h>
using namespace std;
template <class T>
T mymax(T a, T b) {
  return a > b ? a : b;
}
template <class T>
T mymin(T a, T b) {
  return a < b ? a : b;
}
int main() {
  int n, m;
  vector<int> v;
  int bc = 0, cp = 0, i;
  cin >> n >> m;
  while (n--) {
    cin >> i;
    if (cp + i <= m) {
      cp += i;
      continue;
    } else {
      bc++;
      cp = i;
    }
  }
  if (cp != 0) {
    bc++;
  }
  cout << bc << "\n";
  return 0;
}
