#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
using namespace std;
#define TR(i,v)         for(__typeof((v).begin())i=(v).begin();i!=(v).end();++i)
#define DEBUG(x)        cout << #x << " = " << x << endl;
#define SIZE(p)         (int)(p).size()
#define MP(a, b)        make_pair((a), (b))
#define ALL(p)          (p).begin(), (p).end()
#define rep(i, n)       for(int (i)=0; (i)<(int)(n); ++(i))
#define REP(i, a, n)    for(int (i)=(a); (i)<(int)(n); ++(i))
#define FOR(i, a, b)    for(int (i)=(int)(a); (i)<=(int)(b); ++(i))
#define FORD(i, b, a)   for(int (i)=(int)(b); (i)>=(int)(a); --(i))
#define CLR(x, y)       memset((x), (y), sizeof((x)))
typedef unsigned long long LL;
typedef pair<int, int> pii;
const LL base = 9875321;
int M,L,n;
map<LL,int> mp;
char S[100005];
LL POW[100005], H[100005];
inline int get(int st) {
	static LL A[100005];	
	int k=0;
	for(int i=st;i+L-1<n;i+=L)	A[k++]=H[i]-H[i+L]*POW[L];	
	mp.clear();
	int res=0,i=0,j=-1;
	for(;i<k;++i) {
		while(j-i+1<M && j+1<k)
			++mp[A[++j]];
		res+=SIZE(mp)==M;
		if(--mp[A[i]]==0)	mp.erase(A[i]);
	}
	return res;
}
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
    freopen("I.in", "r", stdin);
    // freopen("out", "w", stdout);
#endif
    // ios::sync_with_stdio(false);		cin.tie(0);
    POW[0]=1;	FOR(i,1,100000)	POW[i]=base*POW[i-1];
    while(scanf("%d%d", &M,&L)==2) {
    	scanf("%s",S);
    	n=strlen(S);
    	H[n]=0;
    	FORD(i,n-1,0)	H[i]=H[i+1]*base+S[i];
    	int res=0;
    	rep(i,L)	res+=get(i);
    	printf("%d\n",res);
    }
    return 0;
}