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;


// returns min(x : where As[i:i+x) contains all the elements of [1..K])
int smallest_window(int K, vector<int> As){
    vector<int> freq(K + 1, 0);
    int t = K;
    int record = As.size() + 10;
    int tail = 0;
    for (int head = 0; head < As.size(); ++head){
        while (tail < As.size() and t > 0){
            int a = As[tail];
            if (1 <= a and a <= K){
                ++freq[a];
                if (freq[a] == 1) --t;
            }
            ++tail;
        }
        if (t == 0 and tail - head < record) record = tail - head;
        int a = As[head];
        if (1 <= a and a <= K){
            --freq[a];
            if (freq[a] == 0) ++t;
        }
    }
    if (record > As.size()) return 0;
    return record;
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    vector<int> As(N);
    for (auto & a : As) cin >> a;
    cout << smallest_window(K, As) << endl;
    return 0;
}