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:
#include <bits/stdc++.h>
using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
 
string to_string(const string& s) {
  return '"' + s + '"';
}
 
string to_string(const char* s) {
  return to_string((string) s);
}
 
string to_string(bool b) {
  return (b ? "true" : "false");
}
 
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
 
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
 
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
 
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
 
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}
 
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
 
void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define fi first
#define se second
#define pb push_back
#define mod(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,a,b) for(int i = a; i < b; i++)
#define forr(i,a,b) for(int i = a; i >= b; i--)
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

const int mod = 1e9+7;
int sum(int a, int b){return (a+b) % mod;}
int sub(int a, int b){return (a + mod - b) % mod;}
int mul(int a, int b){return (1ll * a * b) % mod;}
int power(int a,int b){
	int res = 1;
	while(b){
		if(b&1)res = mul(res,a);
		b >>= 1;
		a = mul(a,a);
	}
	return res;
}

const int maxn = 2e5+5;
const int maxk = 18;
const int oo = 1e9;

int N,K,memo[(1<<maxk)],sig[maxk][maxn],ac[maxk][maxn];
char A[maxn];

int dp(int mask){
	if(mask == 0)return 0;
	if(__builtin_popcount(mask) == 1){
		forn(i,0,K)if(mask&(1<<i))return sig[i][0];
	}
	int &res = memo[mask];
	if(res != -1)return res;
	res = oo;
	forn(i,0,K){
		if(!(mask&(1<<i)))continue;
		int mini = dp(mask^(1<<i))+1;
		if(mini <= N-1)
			res = min(res,sig[i][mini]);
	}
	return res;
	
}
int get(int i,int j,int k){
	int res = ac[k][j];
	if(i)res -= ac[k][i-1];
	return res;
}
int can(int len){
	forn(i,0,K){
		forr(j,N-1,0){
			sig[i][j] = oo;
			if(j+1 <= N-1)sig[i][j] = min(sig[i][j],sig[i][j+1]);
			if(j+len-1 <= N-1){
				int s = get(j,j+len-1,i)+get(j,j+len-1,17);
				if(s == len)sig[i][j] = min(sig[i][j],j+len-1);
			}
		}
	}
	memo[0] = 0;
	forn(mask,1,(1<<K)){
		if(__builtin_popcount(mask) == 1){
			forn(i,0,K)if(mask&(1<<i))memo[mask] = sig[i][0];
			continue;
		}
		int &res = memo[mask];
		res = oo;
		forn(i,0,K){
			if(!(mask&(1<<i)))continue;
			int mini = memo[mask^(1<<i)]+1;
			if(mini <= N-1)
				res = min(res,sig[i][mini]);
		}
	}
	return memo[(1<<K)-1] <= N-1;
	//forn(i,0,(1<<K))memo[i] = -1;
	//int res = dp((1<<K)-1);
	//return res <= N-1;
}
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> K;
	forn(i,0,N)cin >> A[i];
	forn(i,0,N){
		int add = (A[i] == '?');
		ac[17][i] = add;
		if(i)ac[17][i] += ac[17][i-1];
	}
	forn(i,0,K){
		char c = (char)(i+'a');
		forn(j,0,N){
			int add = (c == A[j]);
			ac[i][j] = add;
			if(j)ac[i][j] += ac[i][j-1];
		}
	}
	int ini = 0,fin = N+1;
	while(ini < fin){
		int mit = (ini+fin)>>1;
		if(!can(mit))fin = mit;
		else ini = mit+1;
	}
	cout << ini-1 << '\n';
	return 0;
}
/*
__builtin_mul_overflow(x,y,&x)
-fsplit-stack
*/