#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, j;
  cin >> n >> m;
  int a[n], count = 0, sum = 0;
  for (j = 0; j < n; j++) cin >> a[j];
  for (j = 0; j < n; j++) {
    sum = sum + a[j];
    if (m < sum) {
      j = j - 1;
      count++;
      sum = 0;
    } else if (m == sum) {
      count++;
      sum = 0;
    } else if (m > sum && j == n - 1)
      count++;
  }
  cout << count << "\n";
  return 0;
}
