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