program writing;
var
g,s,i,z,tot,t,ans:longint;
mb,hash:array[1..150]of longint;
line:array[1..3000000]of 1..150;
c:char;
fin,fout:text;
begin
assign(fin,'writing.in'); reset(fin);
assign(fout,'writing.out'); rewrite(fout);
readln(fin,g,s);
for i:=1 to 150 do begin mb[i]:=0; hash[i]:=0; end;
for i:=1 to g do
begin
read(fin,c);
inc(mb[ord(c)]);
end;
readln(fin);
z:=0;
for i:=1 to 150 do
begin
if mb[i]<>0 then inc(z);
end;
tot:=0;
for i:=1 to g do
begin
read(fin,c); line[i]:=ord(c); t:=line[i];
inc(hash[t]);
if hash[t]=mb[t] then inc(tot);
end;
if tot=z then ans:=1 else ans:=0;
for i:=g+1 to s do
begin
read(fin,c); line[i]:=ord(c); t:=line[i];
inc(hash[t]);
if hash[t]=mb[t] then inc(tot);
dec(hash[line[i-g]]);
if hash[line[i-g]]=(mb[line[i-g]]-1) then dec(tot);
if tot=z then inc(ans);
end;
writeln(fout,ans);
close(fin);
close(fout);
end.