{-# OPTIONS_GHC -O #-}
{-# LANGUAGE ViewPatterns #-}

import Control.Monad
import Data.List
import Data.Char
import qualified Data.ByteString.Char8 as B

main=do
    [n,k]<-map read.words<$>getLine :: IO [Int]
    as <- unfoldr (B.readInt.B.dropWhile (==' ')) <$> B.getLine
    --
    print $ if n<=k
        then 1
        else let (c,bs) = lchk 0 k as in fst $ lchk c k (reverse bs)

lchk n k ar
    | (f1 ar) <= k = (n+1, 1:(drop k ar))
    | True = lchk (n+1) k (drop (k-1) ar)

f1 as = case findIndex (==1) as of
            Just i -> i+1
            Nothing -> undefined
