program gracia;
const
fin='writing.in';fout='writing.out';
var
f,c:array[0..53] of longint;
a:array[1..3000000] of longint;
g,s,ans:longint;
f1,f2:text;
procedure init;
var
ch:char;
i:longint;
begin
assign(f1,fin);reset(f1);
readln(f1,g,s);
for i:=1 to g do
begin
read(f1,ch);
if ord(ch)<=90 then inc(c[ord(ch)-64])
else inc(c[ord(ch)-70]);
end;
readln(f1);
for i:=1 to s do
begin
read(f1,ch);
if ord(ch)<=90 then a[i]:=ord(ch)-64
else a[i]:=ord(ch)-70;
end;
close(f1);
end;
procedure main;
var
i,k,count,sum:longint;
begin
k:=0;
count:=0;sum:=0;
for i:=1 to s-g+1 do
begin
while (count<g)and(k<s) do
begin
inc(k); inc(f[a[k]]);
if f[a[k]]<=c[a[k]] then
begin inc(count); sum:=k-i+1;end;
end;
if sum=g then inc(ans);
dec(f[a[i]]);
if f[a[i]]<c[a[i]] then dec(count);
dec(sum);
end;
end;
BEGIN
init;
main;
assign(f2,fout);rewrite(f2);
writeln(f2,ans);
close(f2);
END.