f n ('2':s) i =0:(f n s i)
f 1 _ i       =[i]
f n s i       =if s!!0==s!!1 then(f(n-1)(tail s)(i+1))else(i:(f(n-1)(tail s)1))
g 0 _ _ i     =i
g 1 _ _ i     =i
g n k s i     =g (n-2) k (drop 2 s) (max(sum(take(2*k+1)s))i)

main=do
 [n,k]<-map read.words<$>getLine
 s<-(\x->f n x 1).(\x->if x!!0=='1' then x else ('2':x))<$>getLine
 print(g (length s) k s 1)