var len1,len2:longint;
s1,s2:ansistring;
suma,nowa:array['a'..'z'] of longint;
sumb,nowb:array['A'..'Z'] of longint;
procedure main;
var i,flag,ans:longint;
begin
fillchar(suma,sizeof(suma),0);
fillchar(sumb,sizeof(sumb),0);
fillchar(nowa,sizeof(nowa),0);
fillchar(nowb,sizeof(nowb),0);
for i:=1 to len1 do
if s1[i] in ['a'..'z'] then inc(suma[s1[i]])
else inc(sumb[s1[i]]);
flag:=0; ans:=0;
for i:=1 to len2 do
begin
if s2[i] in ['a'..'z'] then begin
inc(nowa[s2[i]]);
if nowa[s2[i]]>suma[s2[i]] then inc(flag);
end
else begin
inc(nowb[s2[i]]);
if nowb[s2[i]]>sumb[s2[i]] then inc(flag);
end;
if i>=len1 then
begin
if flag=0 then inc(ans);
if s2[i-len1+1] in ['a'..'z'] then begin
if nowa[s2[i-len1+1]]>suma[s2[i-len1+1]] then dec(flag);
dec(nowa[s2[i-len1+1]]);
end
else begin
if nowb[s2[i-len1+1]]>sumb[s2[i-len1+1]] then dec(flag);
dec(nowb[s2[i-len1+1]]);
end;
end;
end;
writeln(ans);
end;
begin
assign(input,'writing.in'); reset(input);
assign(output,'writing.out'); rewrite(output);
readln(len1,len2);
readln(s1);
readln(s2);
main;
close(input); close(output);
end.