#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  int sum = 0;
  int res = 0;
  vector<int> arr(n);
  for (int &w : arr) cin >> w;
  for (int i = 0; i < n; ++i) {
    if (sum + arr[i] <= m) {
      sum += arr[i];
    } else {
      sum = arr[i];
      ++res;
    }
  }
  if (sum) ++res;
  cout << res << '\n';
  return 0;
}
