#include <stdio.h>
#include <stdlib.h>

int main()
{
  int i, n, s, sum, head, tail, len, minlen;
  scanf("%d %d", &n, &s);
  int *a = (int*)malloc(sizeof(int)*n);
  for (i=0; i<n; i++) scanf("%d", &a[i]);
  head = tail = sum = 0;
  minlen = n+1;
  for (i=0; i<n; i++) {
    sum += a[i];
    while (sum >= s) {
      len = i - tail + 1;
      if (len<minlen) minlen = len;
      sum -= a[tail];
      tail++;
    }
  }
  printf("%d\n", minlen>n?0:minlen);
  return 0;
}
