Cute Ryan

Given a row of N dolls labeled 1 or 2, find the length of the shortest contiguous block containing at least K dolls labeled 1.

Medium5Two pointersSliding windowArrayPrefix sumInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

NN dolls are placed in a row. Each doll is either a Ryan doll or an Apeach doll. A Ryan doll is written as 1 and an Apeach doll as 2. Find the length of the shortest contiguous block of dolls that contains at least KK Ryan dolls.

Input

The first line contains NN and KK. (1KN1061 \le K \le N \le 10^6)

The second line contains NN space-separated integers describing the dolls. Each value is 1 or 2.

Output

Print the length of the shortest contiguous block that contains at least KK Ryan dolls. If no such block exists, print -1.