Your classmate, whom you do not like because he is boring, but whom you respect for his intellect, has two strings: s of length n and t of length m.

A sequence p_1, p_2, …, p_m, where 1 ≤ p_1 < p_2 < … < p_m ≤ n, is called beautiful, if s_{p_i} = t_i for all i from 1 to m. The width of a sequence is defined as max_{1 ≤ i < m} \left(p_{i + 1} - p_i\right).

Please help your classmate to identify the beautiful sequence with the maximum width. Your classmate promised you that for the given strings s and t there is at least one beautiful sequence.

Input

The first input line contains two integers n and m (2 ≤ m ≤ n ≤ 2 ⋅ 10^5) — the lengths of the strings s and t.

The following line contains a single string s of length n, consisting of lowercase letters of the Latin alphabet.

The last line contains a single string t of length m, consisting of lowercase letters of the Latin alphabet.

It is guaranteed that there is at least one beautiful sequence for the given strings.

Output

Output one integer — the maximum width of a beautiful sequence.

Examples

Input


5 3
abbbc
abc


Output


3


Input


5 2
aaaaa
aa


Output


4


Input


5 5
abcdf
abcdf


Output


1


Input


2 2
ab
ab


Output


1

Note

In the first example there are two beautiful sequences of width 3: they are \{1, 2, 5\} and \{1, 4, 5\}.

In the second example the beautiful sequence with the maximum width is \{1, 5\}.

In the third example there is exactly one beautiful sequence — it is \{1, 2, 3, 4, 5\}.

In the fourth example there is exactly one beautiful sequence — it is \{1, 2\}.
import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger; 
//import javafx.util.*; 
public final class B
{    
	static StringBuilder ans=new StringBuilder();
	static FastReader in=new FastReader();
	static ArrayList<ArrayList<Integer>> g,lang;	
	static long mod=1000000007;
	static int D1[],D2[],par[];
	static boolean set[];
	public static void main(String args[])throws IOException
	{  		
			int N=i(),M=i();
			char A[]=in.next().toCharArray(),B[]=in.next().toCharArray();
			if(N==M)
			{
				System.out.println(1);
				return;
			}			
			int pre[]=new int[M];
			int post[]=new int[M];
			int index=0;
			for(int i=0; i<N; i++)
			{
				if(A[i]==B[index])
				{
					pre[index++]=i;
				}
				if(index==M)break;
			}
			index=M-1;
			for(int i=N-1; i>=0; i--)
			{
				if(A[i]==B[index])
				{
					post[index--]=i;
				}
				if(index<0)break;
			}
			//print(pre);print(post);
			int max=0;
			for(int i=0; i<M-1; i++)
			{
				max=Math.max(max, post[i+1]-pre[i]);
			}
			System.out.println(max);
	}
	static int update(int j)
	{
		for(; j>0; j--)
		{
			if(!set[j])return j;
		}
		return -1;
	}
	
	static boolean find(String X,String B)
	{
		int N=B.length();
		if(N+2>X.length())return false;
		StringBuilder Y=new StringBuilder();
		int i=0;
		for( i=1; i<=N; i++)
		{
			Y.append(X.charAt(i));
		}

		if(Y.toString().equals(B))return true;
		for(; i<X.length()-1; i++)
		{
			Y.delete(0,1);
			Y.append(X.charAt(i));
			//System.out.println(Y);
			if(Y.toString().equals(B))return true;
		}
		return false;
	}
	static long min(long a,long b,long c)
	{
		return Math.min(a, Math.min(c, b));
	}
	static void dfs(int n)
	{
		set[n]=true;
		for(int c:g.get(n))
		{
			if(!set[c])dfs(c);
		}
	}
	static void print(int a)
	{
		System.out.println("! "+a);
	}
	static int ask(int a,int b)
	{
		System.out.println("? "+a+" "+b);
		return i();
	}
	static int find(int a)
	{
		if(par[a]<0)return a;
		return par[a]=find(par[a]);
	}
	static void union(int a,int b)
	{
		a=find(a);
		b=find(b);
		if(a!=b)
		{
			par[a]+=par[b]; //transfers the size
			par[b]=a;       //changes the parent
		}
	}
	static ArrayList<Integer> IND(int B[],HashMap<Integer,Integer> mp)
	{
		ArrayList<Integer> A=new ArrayList<>();
		for(int i:B)
		{
			if(mp.containsKey(i))
			{
				A.add(i);
				int f=mp.get(i)-1;
				if(f==0)
					mp.remove(i);
				else mp.put(i, f);		
			}
		}
		return A;
	}
	static HashMap<Integer,Integer> hash(int A[],int index)
	{
		HashMap<Integer,Integer> mp=new HashMap<Integer,Integer>();
		for(int i=index; i<A.length; i++)
		{
			int f=mp.getOrDefault(A[i], 0)+1;
			mp.put(A[i], f);
		}
		return mp;
	}
	static void swap(char A[],int a,int b)
	{
		char ch=A[a];
		A[a]=A[b];
		A[b]=ch;
	}

	static long lower_Bound(long A[],int low,int high, long x) 
	{ 
		if (low > high) 
			if (x >= A[high]) 
				return A[high]; 

		int mid = (low + high) / 2; 

		if (A[mid] == x) 
			return A[mid]; 

		if (mid > 0 && A[mid - 1] <= x && x < A[mid]) 
			return A[mid - 1]; 

		if (x < A[mid]) 
			return lower_Bound( A, low, mid - 1, x); 

		return lower_Bound(A, mid + 1, high, x); 
	} 
	static void sort(long[] a) //check for long
	{
		ArrayList<Long> l=new ArrayList<>();
		for (long i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	static void setGraph(int N)
	{
		set=new boolean[N+1];
		//size=new int[N+1];
		//par=new int[N+1];
		g=new ArrayList<ArrayList<Integer>>();
		lang=new ArrayList<ArrayList<Integer>>();
		//tg=new ArrayList<ArrayList<Integer>>();
		for(int i=0; i<=N; i++)
		{
			g.add(new ArrayList<Integer>());
			lang.add(new ArrayList<Integer>());
			//tg.add(new ArrayList<Integer>());
		}
	}

	static  long pow(long a,long b)
	{
		long mod=1000000007;
		long pow=1;
		long x=a;
		while(b!=0)
		{
			if((b&1)!=0)pow=(pow*x)%mod;
			x=(x*x)%mod;
			b/=2;
		}
		return pow;
	}
	static long toggleBits(long x)//one's complement || Toggle bits
	{
		int n=(int)(Math.floor(Math.log(x)/Math.log(2)))+1;

		return ((1<<n)-1)^x;
	}
	static int countBits(long a)
	{
		return (int)(Math.log(a)/Math.log(2)+1);
	}
	static void sort(int[] a) {
		ArrayList<Integer> l=new ArrayList<>();
		for (int i:a) l.add(i);
		Collections.sort(l);
		for (int i=0; i<a.length; i++) a[i]=l.get(i);
	}
	static boolean isPrime(long N)
	{
		if (N<=1)  return false; 
		if (N<=3)  return true; 
		if (N%2 == 0 || N%3 == 0) return false; 
		for (int i=5; i*i<=N; i=i+6) 
			if (N%i == 0 || N%(i+2) == 0) 
				return false; 
		return true; 
	}
	static long GCD(long a,long b) 
	{
		if(b==0)
		{
			return a;
		}
		else return GCD(b,a%b );
	}

	//Debugging Functions Starts

	static void print(char A[])
	{
		for(char c:A)System.out.print(c+" ");
		System.out.println();
	}
	static void print(boolean A[])
	{
		for(boolean c:A)System.out.print(c+" ");
		System.out.println();
	}
	static void print(int A[])
	{
		for(int a:A)System.out.print(a+" ");
		System.out.println();	
	}
	static void print(long A[])
	{
		for(long i:A)System.out.print(i+ " ");
		System.out.println();

	}
	static void print(ArrayList<Integer> A)
	{
		for(int a:A)System.out.print(a+" ");
		System.out.println();
	}

	//Debugging Functions END
	//----------------------
	//IO FUNCTIONS STARTS
	static HashMap<Integer,Integer> Hash(int A[])
	{
		HashMap<Integer,Integer> mp=new HashMap<>();
		for(int a:A)
		{
			int f=mp.getOrDefault(a,0)+1;
			mp.put(a, f);
		}
		return mp;
	}
	static int i()
	{
		return in.nextInt();
	}

	static long l()
	{
		return in.nextLong();
	}

	static int[] input(int N){
		int A[]=new int[N];
		for(int i=0; i<N; i++)
		{
			A[i]=in.nextInt();
		}
		return A;
	}

	static long[] inputLong(int N)     {
		long A[]=new long[N];
		for(int i=0; i<A.length; i++)A[i]=in.nextLong();
		return A;
	}

	//IO FUNCTIONS END

}


//Code For FastReader
//Code For FastReader
//Code For FastReader
//Code For FastReader
class FastReader
{
	BufferedReader br;
	StringTokenizer st;
	public FastReader()
	{
		br=new BufferedReader(new InputStreamReader(System.in));
	}

	String next()
	{
		while(st==null || !st.hasMoreElements())
		{
			try
			{
				st=new StringTokenizer(br.readLine());
			}
			catch(IOException e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

	int nextInt()
	{
		return Integer.parseInt(next());
	}

	long nextLong()
	{
		return Long.parseLong(next());
	}

	double nextDouble()
	{
		return Double.parseDouble(next());
	}

	String nextLine()
	{
		String str="";
		try
		{
			str=br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}

}