import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed as VU
import Data.Char

solve :: Int -> Int -> Int -> Int 
solve n k i = (f left) + (f right)
    where
        f a = ceiling $ (fromIntegral a / (fromIntegral $ k-1))
        left = max 0 $ length [0..i] - 1
        right = max 0 $ length [i..n] - 1

main = do
    [n,k] <- map read . words <$> getLine
    xs <- VU.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
    let Just i = VU.elemIndex 1 xs
    print $ solve n k i