#include <iostream>
#include <cstring>
#include <map>
#include <vector>
#include <cstdio>

using namespace std;

typedef unsigned long long LL;

const int base = 999983;

int m,l;
char ch[100100];
vector<LL> str;
vector<LL> v;
map<LL,int> g;
LL pre[100100];

LL check(LL now,int pos){
	return now-str[pos]*pre[l];
}

int main(){

	pre[0]=1;
	for (int i=1;i<=100000;i++)
		pre[i]=pre[i-1]*base;
	while (scanf("%d %d",&m,&l)!=EOF){
		scanf("%s",ch);
		int len=strlen(ch);
		str.clear();
		LL s=0;
		str.push_back(0);
		for (int i=0;i<len;i++){
			s = s*base+ch[i]-'a'+1;
			str.push_back(s);
		}

		int ans=0;
		for (int i=0;i<l;i++){
			int now=0;
			g.clear();
			
			v.clear();
			for (int j=i;j+l<=len;j+=l) v.push_back(check(str[j+l],j));
			for (int j=0;j<v.size();j++){
				if (j>=m){
					g[v[j-m]]--;
					if (g[v[j-m]]==0) g.erase(v[j-m]);
				}
				g[v[j]]++;
				if (g.size()==m) ans++;
				//cout<<ans<<endl; 
			}
			//cout<<ans<<endl;

			
		}
		printf("%d\n",ans);
		//cout<<ans<<endl;

	}
	return 0;
}
