program xxxx;
var s:array[1..3000000] of char;
g:array[1..3000] of char;
ch1,ch2:array['A'..'z'] of longint;
m,n,i,j,flag,x:longint;
chr:char;
begin
assign(input,'writing.in');
reset(input);
assign(output,'writing.out');
rewrite(output);
readln(n,m);
for i:=1 to n do
begin
read(g[i]);
inc(ch1[g[i]]);
end;
readln;
for i:=1 to m do
read(s[i]);
for i:=1 to m-n+1 do
begin
flag:=0;
for chr:='A' to 'z' do
ch2[chr]:=0;
for j:=i to i+n-1 do
begin
inc(ch2[ s[j] ]);
if ch2[ s[j] ]>ch1[ s[j] ] then
begin
flag:=1;
break;
end;
end;
if flag<>1 then
inc(x);
end;
write(x);
close(input);
close(output);
end.