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<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
#include<set>
using namespace std;

typedef long long ll;

const int NIL = -1;
const int MAX = 2147483647;
const int INF = -10001;
const int N = 1000001;
clock_t START, END;
bool debug = false;

int setv[N];

int main(void)
{
	if (debug) {
		START = clock();
		freopen("in18.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int n, K, i, _size = MAX;
	set<int> S;
	queue<int> Q;
	scanf("%d%d", &n, &K);
	vector<int> V(K + 1);
	for (i = 0; i < n; i++)
		scanf("%d", &setv[i]);
	i = 0;
	V[0] = 1;
	Q.push(setv[0]);
	if (setv[0] >= 1 && setv[0] <= K) {
		V[setv[0]]++;
	}
	while (i < n) {
		if (find(V.begin(), V.end(), 0) == V.end()) {
			_size = min(_size, static_cast<int>(Q.size()));
			if (Q.front() >= 1 && Q.front() <= K) {
				V[Q.front()]--;
			}
			Q.pop();
		}
		else {
			i++;
			Q.push(setv[i]);
			if (setv[i] >= 1 && setv[i] <= K) {
				V[setv[i]]++;
			}
		}
	}
	if (_size == MAX)
		printf("0\n");
	else
		printf("%d\n", _size);
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}