#include <bits/stdc++.h>
using namespace std;
const int MXN = 100100;
const int Q = 320;
const int MXK = 10000;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const int mod = 1000000007;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int q = 0;
  int cur = 0;
  for (int i = (0); i < (n); i++) {
    int t;
    scanf("%d", &t);
    if (cur + t > m) {
      q++;
      cur = 0;
    }
    cur += t;
  }
  if (cur > 0) q++;
  cout << q;
}
