#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int cnt = 0, rem = m;
  int arr[10000];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    if (rem >= arr[i])
      rem -= arr[i];
    else {
      cnt++;
      rem = m;
      rem -= arr[i];
    }
  }
  cout << cnt + 1;
}
