program writing(input,output);
var
i,j,max,k:longint;
n,m:longint;
a:array[1..3000000]of char;
s:array['A'..'z']of longint;
q:array['A'..'z']of longint;
c:char;
b:boolean;
function pan:boolean;
var
c:char;
begin
for c:='A' to 'z' do
if s[c]<>q[c] then exit(false);
exit(true);
end;
begin
assign(input,'writing.in');
reset(input);
assign(output,'writing.out');
rewrite(output);
readln(n,m);
for c:='A' to 'z' do
begin
s[c]:=0;
q[c]:=0;
end;
for i:=1 to n do
begin
read(c);
inc(s[c]);
end;
readln;
for i:=1 to m do
begin
read(a[i]);
end;
readln;
for i:=1 to n do
inc(q[a[i]]);
if pan then max:=1 else max:=0;
for i:=n+1 to m do
begin
dec(q[a[i-n]]);
inc(q[a[i]]);
if pan then inc(max);
end;
writeln(max);
close(input);
close(output);
end.