Let's introduce the designation <image>, where x is a string, n is a positive integer and operation " + " is the string concatenation operation. For example, [abc, 2] = abcabc.

We'll say that string s can be obtained from string t, if we can remove some characters from string t and obtain string s. For example, strings ab and aсba can be obtained from string xacbac, and strings bx and aaa cannot be obtained from it.

Sereja has two strings, w = [a, b] and q = [c, d]. He wants to find such maximum integer p (p > 0), that [q, p] can be obtained from string w.

Input

The first line contains two integers b, d (1 ≤ b, d ≤ 107). The second line contains string a. The third line contains string c. The given strings are not empty and consist of lowercase English letters. Their lengths do not exceed 100.

Output

In a single line print an integer — the largest number p. If the required value of p doesn't exist, print 0.

Examples

Input

10 3
abab
bab


Output

3
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class TaskB implements Runnable {
	
	private void readData() {
		
	}
	
	@Override
	public void run() {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int b = in.readInt();
		int d = in.readInt();
		String a = in.next();
		String c = in.next();
		if (impossible(a, c)) {
			out.println(0);
		}
		else {
			int lengthA = a.length();
			int lengthC = c.length();
			int[] count = new int[lengthA];
			int[] lastPosition = new int[lengthA];
			int[] add = new int[lengthA];
			for (int startPosition = 0; startPosition < lengthA; ++startPosition) {
				int cnt = 0;
				int curA = startPosition;
				int go = 0;
				int curC = 0;
				int lastSuccess = 0;
				while (true) {
					if (c.charAt(curC) == a.charAt(curA)) {
						int lp = curA;
						++curC;
						++curA;
						if (curA == lengthA) {
							if (curC == lengthC) {
								lastSuccess = lp;
								++cnt;
								curC = 0;
							}
							if (cnt > 0) {
								count[startPosition] = cnt;
								lastPosition[startPosition] = lastSuccess;
								add[startPosition] = go;
								break;
							}
							else {
								++go;
								curA = 0;
							}
						}
						else if (curC == lengthC) {
							lastSuccess = lp;
							++cnt;
							curC = 0;
						}
					}
					else {
						++curA;
						if (curA == lengthA) {
							if (cnt > 0) {
								count[startPosition] = cnt;
								lastPosition[startPosition] = lastSuccess;
								add[startPosition] = go;
								break;
							}
							else {
								++go;
								curA = 0;
							}
						}
					}
				}
			}
			int cnt = 0;
			int startPosition = 0;
			int go = 0;
			while (go+add[startPosition] < b) {
				go += add[startPosition];
				cnt += count[startPosition];
				startPosition = lastPosition[startPosition];
				if (startPosition == lengthA-1) {
					startPosition = 0;
					++go;
				}
				else {
					++startPosition;
				}
			}
			out.println(cnt/d);
		}
		out.flush();
	}
	
	private boolean impossible(String a, String c) {
		for (int i = 0; i < c.length(); ++i) {
			if (a.indexOf(c.charAt(i)) == -1) {
				return true;
			}
		}
		return false;
	}
	
	public static void main(String[] args) {
		new TaskB().run();
	}

	private class InputReader {
		
	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

	    public InputReader(InputStream stream) {
	        reader = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }

	    public String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }
	    
	    public int readInt() {
	    	return Integer.parseInt(next());
	    }
	    
	    
	}
}