#D2271. The Smallest Window II
The Smallest Window II
The Smallest Window II
For a given array of elements and an integer , find the smallest sub-array size (smallest window length) where the elements in the sub-array contains all integers in range []. If there is no such sub-array, report 0.
Constraints
Input
The input is given in the following format.
...
Output
Print the smallest sub-array size in a line.
Examples
Input
6 2 4 1 2 1 3 5
Output
2
Input
6 3 4 1 2 1 3 5
Output
3
Input
3 4 1 2 3
Output
0
inputFormat
Input
The input is given in the following format.
...
outputFormat
Output
Print the smallest sub-array size in a line.
Examples
Input
6 2 4 1 2 1 3 5
Output
2
Input
6 3 4 1 2 1 3 5
Output
3
Input
3 4 1 2 3
Output
0
样例
3 4
1 2 3
0