var
n,l,p,i,total:longint;
ch:char;
s:array[0..3000000]of char;
a:array['A'..'z']of boolean;
f,b:array['A'..'z']of longint;
function yes(k:longint):boolean;
var
j:longint;
c:char;
begin
for c:='A' to 'z' do f[c]:=b[c];
for j:=k to k+n-1 do
begin
f[s[j]]:=f[s[j]]-1;
if (not a[s[j]])or(f[s[j]]<0) then exit(false)
end;
exit(true);
end;
begin
assign(input,'writing.in'); reset(input);
assign(output,'writing.out'); rewrite(output);
readln(n,p);
for i:=1 to n do
begin
read(ch);
a[ch]:=true;
b[ch]:=1;
end;
readln;
for i:=1 to p do
read(s[i]);
readln;
for i:=1 to p-n+1 do
if yes(i) then inc(total);
writeln(total);
close(input);
close(output);
end.