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:
#include <bits/stdc++.h>

using namespace std;

int n, k;
vector<int> V;

bool solve(int ans){
	vector<int> freq(k);

	int tot = 0;

	for (int i = 0; i < ans; ++i){
		int a = V[i];
		if (a >= k) continue;
		if (!freq[a]) tot++;
		freq[a]++;
	}

	for (int i = ans; tot < k && i < n; ++i){
		int a = V[i];
		if (a < k){
			if (!freq[a]) tot++;
			freq[a]++;
		}
		a = V[i - ans];
		if (a < k){
			freq[a]--;
			if (!freq[a]) tot--;
		}
	}

	return tot >= k;
}

int main() {
	cin >> n >> k;

	V = vector<int>(n);
	for (int i = 0; i < n; ++i){
		cin >> V[i];
		V[i]--;
	}

	if (!solve(n)){
		cout << 0 << endl;
		return 0;
	}

	int lo = 0;
	int hi = n;

	while (lo < hi - 1){
		int m = (lo + hi) / 2;
		if (solve(m)) hi = m;
		else lo = m;
	}

	cout << hi << endl;

	return 0;
}