#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, sum = 0, ans = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int value;
    cin >> value;
    sum += value;
    if (sum > m) {
      ans += 1;
      sum = value;
    }
    if (sum == m) {
      ans += 1;
      sum = 0;
    }
  }
  if (sum != 0) ans += 1;
  cout << ans;
}
