Олимпиадный тренинг

Задача 28341. Two pointer method


Задача

Темы: "Два указателя"
Given an array of N positive numbers. Find in it the minimum number of consecutive numbers such that their sum is greater than K.

Input
The first line contains the number N, the second - K (0<N<= 106, 0<=K<= 109). The third line contains the natural numbers of the sequence.

Imprint
Print the length of the smallest sequence of numbers whose sum is greater than K. If such a sequence is not found, then print -1.
 
Examples
# Input Output
1 6
7
3 1 3 2 4 3
3