program writing;
var
gf,f:array ['A'..'z'] of longint;
ch,g,s:ansistring;
ans,lch,lg,ls,i,j:longint;
function judge:boolean;
var i:longint;
begin
for i:=1 to lch do begin
if f[ch[i]]<>gf[ch[i]] then begin
exit (false);
end;
end;
judge:=true;
end;
begin
fillchar (gf,sizeof(gf),0);
fillchar (f,sizeof(f),0);
assign (input,'writing.in');
reset (input);
readln (lg,ls);
readln (g);
readln (s);
close (input);
assign (output,'writing.out');
rewrite (output);
ans:=0;
for i:=1 to lg do begin
inc(gf[g[i]]);
if pos(g[i],ch)=0 then ch:=ch+g[i];
end;
lch:=length(ch);
for i:=1 to lg do inc(f[s[i]]);
if judge then inc(ans);
i:=2;
while i<=ls-lg+1 do begin
dec(f[s[i-1]]);
inc(f[s[i-1+lg]]);
if judge then inc(ans);
inc(i);
end;
writeln (ans);
close (output);
end.