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 <map>
using namespace std;

template<class like_bool> inline void YES(like_bool condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class like_bool> inline void Yes(like_bool condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class like_bool> inline void POSS(like_bool condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class like_bool> inline void Poss(like_bool condition){ if(condition)cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class like_bool> inline void First(like_bool condition){ if(condition)cout << "First" << endl; else cout << "Second" << endl; }
int character_count(string text, char character){ int ans = 0; for(int i = 0; i < text.size(); i++){ ans += (text[i] == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}};
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
long gcd(long a, long b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }}
#define mod long(1e9 + 7)
#define bitcount(n) __builtin_popcount(n)

int main(){
    int N, K;
    cin >> N >> K;
    map<int, int> nums_count;
    int nums[N];
    for(int i = 0; i < N; i++){
        cin >> nums[i];
    }
    int left_pointer = 0, right_pointer = 0; // [left, right)
    int ans = 1e9;
    while(right_pointer < N){
        if(nums_count.size() < K){
            if(nums[right_pointer] <= K){
                nums_count[nums[right_pointer]]++;
            }
            right_pointer++;
        }else if(left_pointer != right_pointer){
            if(nums[left_pointer] <= K){
                nums_count[nums[left_pointer]]--;
                if(!nums_count[nums[left_pointer]]){
                    nums_count.erase(nums[left_pointer]);
                }
            }
            left_pointer++;
        }else{
            left_pointer++;
            right_pointer++;
        }
        if(nums_count.size() == K){
            ans = min(ans, right_pointer - left_pointer);
        }
    }
    while(nums_count.size() == K && left_pointer < N){
        if(nums[left_pointer] <= K){
            nums_count[nums[left_pointer]]--;
            if(!nums_count[nums[left_pointer]]){
                break;
            }
        }
        left_pointer++;
        ans = min(ans, right_pointer - left_pointer);
    }
    if(ans == 1e9){
        cout << 0 << endl;
    }else{
        cout << ans << endl;
    }
}