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>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}


typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;
const int mod = 1000000007;

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

    vector<ll> numbers(n);
    rep(i, n) cin >> numbers[i];

    set<ll> used;
    multiset<ll> used_m;

    int r = 0;
    int shortness = INT_MAX;
    for (int l = 0; l < n; l++) {
        while (used.size() < k && r < n) {
            ll next = numbers[r];
            if (next <= k && used.find(next) == used.end()) {
                used.insert(next);
            }
            used_m.insert(next);
            r++;
        }
        if (used.size() < k) continue;
        int now = r - l;
        cmin(shortness, now);
        ll back = numbers[l];
        used_m.erase(used_m.find(back));
        if (used_m.count(back) == 0) {
            used.erase(back);
        }
    }

    if (shortness == INT_MAX) shortness = 0;
    cout << shortness << endl;

}