#include <bits/stdc++.h>
int main() {
  int n, ttl, i, j, temp, arr[100005], h = 0;
  scanf("%d%d", &n, &ttl);
  for (i = 1; i <= n; i++) scanf("%d", &arr[i]);
  for (i = 1; i < n; i++) {
    temp = ttl - arr[i];
    ;
    if (temp >= 0) {
      h++;
      ttl -= arr[i];
    }
    if (temp < 0) temp = ttl;
  }
  if (ttl == arr[n]) h++;
  printf("%d", h);
  return 0;
}
