#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  long n, m, sum, out;
  vector<int> a;
  cin >> n;
  cin >> m;
  sum = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
    sum += tmp;
  }
  int j = 0;
  out = 0;
  while (j < n) {
    if (a[j] == m) {
      out++;
      j++;
    } else {
      long sum_tmp = a[j];
      for (j = j + 1; j < n; j++) {
        if (sum_tmp + a[j] < m) {
          sum_tmp += a[j];
        } else {
          if (sum_tmp + a[j] == m) {
            break;
          }
          if (sum_tmp + a[j] > m) {
            j = j - 1;
            break;
          }
        }
      }
      out++;
      j++;
    }
  }
  cout << out;
}
