program writing;
var s,p:ansistring;
t,k,m,n,i,j:longint;
c:char;
b,q:array['A'..'z']of integer;
{a:array[1..1000000]of ansistring;}
bo,po:boolean;
begin
assign(input,'writing.in');
reset(input);
assign(output,'writing.out');
rewrite(output);
readln(n,m);
for t:=1 to n do
begin
read(c);
inc(b[c]);
end;
readln;
readln(s);
for t:=1 to m-n+1 do
begin
q:=b;
bo:=true;
p:=copy(s,t,n);
for k:=1 to n do
dec(q[p[k]]);
for c:='A' to 'z' do
if q[c]>0 then
begin
bo:=false;
break;
end;
if bo then inc(j);
{begin
for k:=1 to j do
if p=a[k] then
break;
if(j=0)or(p<>a[k]) then
begin
inc(j);
a[j]:=p;
end;
end;}
end;
writeln(j);
close(output);
end.