Problem: For a given array $a_1, a_2, a_3, ... , a_N$ of $N$ elements and an integer $K$, find the smallest sub-array size (smallest window length) where the elements in the sub-array contains all integers in range [$1, 2, ..., K$]. If there is no such sub-array, report 0.

Constraints

* $1 \leq N \leq 10^5$
* $1 \leq K \leq 10^5$
* $1 \leq a_i \leq 10^5$

Input

The input is given in the following format.

$N$ $K$
$a_1$ $a_2$ ... $a_N$

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

Solution (in JAVA):

Solution:
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		int[]a = new int[N];
		Map<Integer, Integer> map = new HashMap<Integer, Integer>();
		for(int i = 0; i < N; i++) {
			a[i] = scan.nextInt();
		}
		scan.close();
		int min = Integer.MAX_VALUE;
		int right = 0;
		for(int left = 0; left < N; left++) {
			while(right < N && map.size() < K) {
				if(a[right] <= K) {
					map.merge(a[right], 1, (val1, val2) -> val1 + val2);
				}
				right++;
			}
			if(map.size() == K) {
				int l = right - left;
				min = Math.min(min, l);
			}
			if(right == left) {
				right ++;
			}else {
				if(a[left] <= K) {
					if(map.get(a[left]) == 1) {
						map.remove(a[left]);
					}else {
						map.merge(a[left], -1, (val1, val2) -> val1 + val2);
					}
				}
			}
		}
		if(min == Integer.MAX_VALUE) {
			System.out.println(0);
		}else {
			System.out.println(min);
		}
	}
}