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