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 CPP):

Solution:
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e9;

int a[110000];
int cnt[110000] = {};

int main(){
	
	long long int n, K;
	cin >> n >> K;
	
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		if(a[i] > K){
			a[i] = 0;
		}
	}
	a[0] = 0;
	n++;
	
	int ans = INF;
	long long int sum = 0;
	int id = 0;
	
	for(int i = 0; i < n; i++){
		cnt[a[i]]--;
		if(cnt[a[i]] == 0){
			sum -= a[i];
		}
		while(sum != K * (K + 1) / 2){
			if(id >= n){
				break;
			}
			id++;
			cnt[a[id]]++;
			if(cnt[a[id]] == 1){
				sum += a[id];
			}
		}
		//cout << i << " " << id << endl;
		if(sum == K * (K + 1) / 2){
			ans = min(ans, id - i);
		}
	}
	
	if(ans == INF){
		cout << "0" << endl;
	}else{
		cout << ans << endl;
	}
	
	return 0;
}