program alex;
var f:text;
    a:array[0..800001]of longint;
    n,l,sol,x,y,i,j:longint;
begin
assign(f,'echilibru.in');reset(f);
readln(f,n,l);
for i:=1 to n do
    read(f,a[i]);
close(f);
sol:=0;
for i:=l+1 to n-l do
    begin
    x:=0;y:=-1;
    for j:=i-l to i+l do
        if a[j]>=a[i] then y:=y+1
                      else x:=x+1;
    if x=y then sol:=sol+1;
    end;
assign(f,'echilibru.out');rewrite(f);
writeln(f,sol);
close(f);
end.
