Problem: You are given a string s of length n. Each character is either one of the first k lowercase Latin letters or a question mark.

You are asked to replace every question mark with one of the first k lowercase Latin letters in such a way that the following value is maximized.

Let f_i be the maximum length substring of string s, which consists entirely of the i-th Latin letter. A substring of a string is a contiguous subsequence of that string. If the i-th letter doesn't appear in a string, then f_i is equal to 0.

The value of a string s is the minimum value among f_i for all i from 1 to k.

What is the maximum value the string can have?

Input

The first line contains two integers n and k (1 ≤ n ≤ 2 ⋅ 10^5; 1 ≤ k ≤ 17) — the length of the string and the number of first Latin letters used.

The second line contains a string s, consisting of n characters. Each character is either one of the first k lowercase Latin letters or a question mark.

Output

Print a single integer — the maximum value of the string after every question mark is replaced with one of the first k lowercase Latin letters.

Examples

Input


10 2
a??ab????b


Output


4


Input


9 4
?????????


Output


2


Input


2 3
??


Output


0


Input


15 3
??b?babbc??b?aa


Output


3


Input


4 4
cabd


Output


1

Note

In the first example the question marks can be replaced in the following way: "aaaababbbb". f_1 = 4, f_2 = 4, thus the answer is 4. Replacing it like this is also possible: "aaaabbbbbb". That way f_1 = 4, f_2 = 6, however, the minimum of them is still 4.

In the second example one of the possible strings is "aabbccdda".

In the third example at least one letter won't appear in the string, thus, the minimum of values f_i is always 0.

Solution (in CPP):

Solution:
/* dont stick to an approach */

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <array>
#include <unordered_set>
#include <stack>
#include <unordered_map>
#include <vector>
#include <numeric>
#include <cstdlib>
#include <bitset>
#include <chrono>
#include <random>
#include <fstream>

using namespace std;

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ldb;

#define PB push_back

#define For(i, n) for (ll i = 0; i < n; i++)

#define trav(a,x) for (auto& a : x)

#define PYES cout<<"YES\n"
#define PNO cout<<"NO\n"
#define PYes cout<<"Yes\n"
#define PNo cout<<"No\n"
//#define endl '\n'

#define sq(x)           (x*x)

#define vll             vector<ll>
#define pll             pair<ll,ll>
#define ff              first
#define ss              second
#define rev(v)          reverse(v.begin(),v.end())
#define srt(v)          sort(v.begin(),v.end())
#define grtsrt(v)       sort(v.begin(),v.end(),greater<ll>())
#define mnv(v)          *min_element(v.begin(),v.end())
#define mxv(v)          *max_element(v.begin(),v.end())
#define all(v)          v.begin(),v.end()
#define ACC(v)          accumulate(v.begin(),v.end(),0ll)

#define eps             1e-9

const double PI=acos(-1.0);

#define Fas ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

mt19937 rng((unsigned int)chrono::steady_clock::now().time_since_epoch().count());

//--------------------------------------------functions-------------------------------------------------//

ll power(ll a,ll b){ll result=1;while(b>0){if(b%2 == 1){result *= a;} a *= a;b /= 2;}return result;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
ll countSetBits(ll x){ll Count=0;while(x>0){if(x&1) Count++;x=x>>1;}return Count;}
bool isPerfectSquare(ll n){ll sr = sqrt(n);if (sr * sr == n)return true;else return false;}
ll mod(ll x,ll M){return ((x%M + M)%M);}
ll add(ll a, ll b,ll M){return mod(mod(a,M)+mod(b,M),M);}
ll mul(ll a, ll b,ll M){return mod(mod(a,M)*mod(b,M),M);}
ll powerM(ll a,ll b,ll M){
    ll res=1ll;
    while(b){
        if(b%2ll==1ll){
            res=mul(a,res,M);
        }
        a=mul(a,a,M);b/=2ll;
    }
    return res;
}
ll mod_inv(ll a, ll m) {
    ll g = m, r = a, x = 0, y = 1;
    while (r != 0) {
        ll q = g / r;
        g %= r; swap(g, r);
        x -= q * y; swap(x, y);
    }
    return mod(x,m);
}


//------------------------------------sieve of erantothenes-----------------------------------------------//
//ll MAXN=1e7+150;
//vector<ll> fact(MAXN+1);
//void sieve_of_erantothenes()
//{
//    fact[1] = 1;
//    for (ll i = 2; i <= MAXN; i++)
//        fact[i] = i;
//    for (ll i = 4; i <= MAXN; i += 2)
//        fact[i] = 2;
//    for (ll i = 3; i * i <= MAXN; i++){
//        if (fact[i] == i){
//            for (ll j = i * i; j <= MAXN; j += i)
//                if (fact[j] == j)
//                    fact[j] = i;
//        }
//    }
//}
//----------------------------------------nCr mod------------------------------------------------------//
ll nCr(ll n, ll k){
    if(n<k) return 0;
    if(k==0) return 1;
    ll res = 1;
    if (k > n - k) k = n - k;
    for(ll i = 0; i < k; ++i){
        res *= (n - i);
        res /= (i + 1);
    }
    return res;
}

ll modInverse(ll n,ll M){
    return powerM(n,M-2,M);
}

vector<ll> factu;
void factcalc(ll n,ll M){
    factu.resize(n+1);
    factu[0]=1;
    for(ll i=1;i<=n;i++){
        factu[i]=mul(factu[i-1],i,M);
    }
}
ll nCrM(ll n,ll r,ll M){
    if(n<r) return 0;
    if(r==0) return 1;
    return mul(mul(factu[n],modInverse(factu[r],M),M),modInverse(factu[n-r],M),M);
}
ll rand_int(ll l, ll r){
    return uniform_int_distribution<ll>(l, r)(rng);
}
//-----------------------------------------------solve-----------------------------------------------------//

void solve(){
    ll n,k;cin>>n>>k;
    string s;cin>>s;
    ll low=1,high=n;
    ll ans=0;
    auto check = [&](ll len)->bool{
        vector<vector<ll>> pos(k,vector<ll> (n+2));
        for(ll i=0;i<k;i++){
            pos[i][n]=pos[i][n+1]=n+1;
            ll l=0;
            for(ll j=n-1;j>=0;j--){
                if(s[j]=='?' || s[j]=='a'+i){
                    l++;
                }else{
                    l=0;
                }
                if(l>=len){
                    pos[i][j]=j+len;
                }else{
                    pos[i][j]=pos[i][j+1];
                }
            }
        }
        vector<ll> dp(1<<k,n+1);
        dp[0]=0;
        for(ll i=0;i<(1<<k);i++){
            for(ll j=0;j<k;j++){
                if(i&(1ll<<j)){
                    continue;
                }
                dp[(1ll<<j)|i]=min(dp[(1ll<<j)|i],pos[j][dp[i]]);
            }
        }
        if(dp.back()<=n){
            return true;
        }else{
            return false;
        }
    };
    while(low<=high){
        ll m=(low+high)/2;
        if(check(m)){
            ans=m;
            low=m+1;
        }else{
            high=m-1;
        }
    }
    cout<<ans<<endl;
}

int main(){
    Fas;

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    cout<<fixed<<setprecision(20);

//    ll t=0;
//    cin>>t;
//    while(t--)

        solve();

    return 0;
}