#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i;
  cin >> n >> m;
  long long int a[n + 1], flag = 0, sum = 0;
  for (i = 0; i < n; i++) cin >> a[i];
  i = 0;
  while (i < n) {
    if (a[i] < m) {
      sum = 0;
      while (sum + a[i] <= m) {
        sum += a[i];
        i++;
      }
      flag++;
    } else if (a[i] == m) {
      flag++;
      i++;
    }
  }
  cout << flag << endl;
  return 0;
}
