program writing(input,output);
var
a:array[1..3000000]of char;
b1,b2:array['0'..'z']of longint;
i,j:longint;
g,s:longint;
ans:longint;
ch:char;
function fuck(x:longint):boolean;
var
p:char;
begin
fuck:=true;
for p:='0' to '9' do
begin
if b2[p]<>b1[p] then
begin
fuck:=false;
exit;
end;
end;
for p:='A' to 'Z' do
if b2[p]<>b1[p] then
begin
fuck:=false;
exit;
end;
for p:='a' to 'z' do
if b2[p]<>b1[p] then
begin
fuck:=false;
exit;
end;
end;
begin
assign(input,'writing.in');
reset(input);
readln(g,s);
for i:=1 to g do
begin
read(ch);
inc(b1[ch]);
end;
readln;
for i:=1 to s do read(a[i]);
close(input);
for i:=1 to g do
inc(b2[a[i]]);
if fuck(0) then inc(ans);
for i:=1 to s-g do
begin
dec(b2[a[i]]);
inc(b2[a[i+g]]);
if fuck(i) then inc(ans);
end;
assign(output,'writing.out');
rewrite(output);
writeln(ans);
close(output);
end.