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;
#define rep(i, n) for(int i=0; i<n; i++)
#define rrep(i, n) for(int i=n-1; i>=0; i--)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = 1e9+7;
template<class T> void puts(T x) { std::cout << x << std::endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int n, k, a[100010];
map<int, int> m;

int main() {
    cin >> n >> k;
    rep(i, n) cin >> a[i];

    int l = 0, r = 0;
    int count = k; // number of matched integers
    int best_l = 0;
    int minLen = INF;
    for (int i = 1; i <= k; i++) m[i] = 1;

    while (r < n) {
        if (1 <= a[r] && a[r] <= k) {
            m[a[r]]--;
            if (m[a[r]] == 0) count--;
        }
        r++;

        if (count == 0) {
            while (count == 0 && l < r) {
                if (1 <= a[l] && a[l] <= k) {
                    m[a[l]]++;
                    if (m[a[l]] == 1) count++;
                }
                if (r - l < minLen) {
                    best_l = l;
                    minLen = r - l;
                }
                l++;
            }
        }
    }

    if (minLen == INF) cout << 0 << endl;
    else cout << minLen << endl;
}