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;

struct RMQ {
	using type = int;
	static type id() { return INT_MAX; }
	static type op(const type& l, const type & r) { return min(l, r); }
};

template <typename M>
class SegmentTree {
	using T = typename M::type;
	const int n;
	vector<T> data;
	int size(int n) {
		int res;
		for (res = 1; res < n; res <<= 1);
		return res;
	}
public:
	SegmentTree(int n_) : n(size(n_)), data(n * 2, M::id()) {}
	SegmentTree(int n_, T val) : n(size(n_)), data(n * 2, val) {}
	void add(int p, T val) {
		p += n;
		data[p] += val;
		while (p >>= 1) data[p] = M::op(data[p * 2], data[p * 2 + 1]);
	}
	T find(int l, int r) {
		l += n; r += n + 1;
		T res1 = M::id(), res2 = M::id();
		while (l < r) {
			if (l & 1) res1 = M::op(res1, data[l++]);
			if (r & 1) res2 = M::op(data[--r], res2);
			l >>= 1; r >>= 1;
		}
		return M::op(res1, res2);
	}
};

int main()
{
	int N, K;
	cin >> N >> K;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i]; a[i]--;
	}
	int l = 0, res = N + 1;
	SegmentTree<RMQ> st(1e5, 0);
	for (int r = 0; r < N; r++) {
		st.add(a[r], 1);
		while (st.find(0, K - 1) >= 1) {
			res = min(res, r - l + 1);
			st.add(a[l++], -1);
		}
	}
	cout << (res == N + 1 ? 0 : res) << endl;
	return 0;
}