var
g,l,wei,t,ans:longint;
w,s:ansistring;
f,f1:array['A'..'z']of longint;
ch:char;
begin
assign(input,'writing.in');
assign(output,'writing.out');
reset(input);
rewrite(output);
readln(g,l);
readln(w);
readln(s);
for wei:=1 to g do
begin
inc(f1[w[wei]]);
inc(f[s[wei]]);
end;
repeat
t:=1;
for ch:='A' to 'z' do
if f[ch]<>f1[ch] then
begin
t:=0;
break;
end;
ans:=ans+t;
if wei<>l then
begin
inc(wei);
dec(f[s[wei-g]]);
inc(f[s[wei]]);
end
else
break;
until 1>2;
writeln(ans);
close(input);close(output);
end.