#include<bits/stdc++.h>
#define maxn 100010
using namespace std;
char s[maxn], t[maxn];
int h[maxn], en[maxn];
int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	scanf("%s%s", s + 1, t + 1);
	for (int i = 1; i <= n - m + 1; i++){
		int flag = 1;
		for (int j = 1; j <= m; j++)
			if (s[i + j - 1] != t[j]) {flag = 0; break;}
		if (flag){
			for (int j = 1; j <= m; j++)
				h[i + j - 1] = 1;
			en[i + m - 1] = 1;
		}
	}
	int res1 = 0, res2 = 0;
	for (int i = 1; i <= n; i++)
		res1 += h[i];
	for (int i = m; i <= n; i++)
		if (en[i]){
			res2++;
			for (int j = 1; j <= m; j++)
				en[i + j - 1] = 0;
		}
	printf("%d %d\n", res1, res2);
	return 0;
}