#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, i, sum = 0, cnt = 0;
  cin >> n >> m;
  int arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < n; i++) {
    if (sum + arr[i] <= m)
      sum += arr[i];
    else {
      cnt++;
      sum = 0;
      i--;
    }
  }
  if (sum) cnt++;
  cout << cnt << endl;
  return 0;
}
