import java.util.Scanner
import scala.collection.mutable.Stack 

object Main extends App { 
  val sc = new Scanner(System.in)
  val N, S = sc.nextInt()
  val array = (for (i <- 0 until N) yield sc.nextInt()).toArray

  def solver(l:Int, r:Int, acc:Int, len:Int):Int = {
    if (r >= N && acc < S) if (len < N+1) len else 0
    else if (acc < S) solver(l, r+1, acc+array(r), len)
    else solver(l+1, r, acc-array(l), len min (r-l))
  }

  println(solver(0, 0, 0, N+1))
}
