#include <cstdio>
typedef unsigned long long ull;
int N, M; char s[1000009]; ull w[500009], p2[500009];
int main() {
	w[0] = 73; p2[0] = 257;
	for (int i = 0; i < 500000; i++) {
		w[i + 1] = w[i] * 66049 + 20376;
		p2[i + 1] = p2[i] * 66049;
	}
	while (scanf("%d", &N), N) {
		scanf("%d%s", &M, s);
		ull h = 0, b = 0, l = N * 2 + 1;
		for (int i = 0; i < l; i++) h = h * 257 + s[i];
		int ret = 0;
		for (int i = l; i <= M; i++) {
			if (h == w[N]) ret++;
			h = h * 257 + s[i] - p2[N] * s[i - l];
		}
		printf("%d\n", ret);
	}
	return 0;
}