#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int buses = 0;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int rem = m;
  for (int i = 0; i < n; i++) {
    if (rem < a[i]) {
      buses++;
      rem = m;
    }
    rem -= a[i];
  }
  cout << buses + 1 << '\n';
  return 0;
}
