main = do
  [n, k] <- map read . words <$> getLine
  as <- map read . words <$> getLine
  print $ solve k n as

solve k n as = solve' k l m
  where
    l = length $ takeWhile (/= 0) as
    m = n - l - 1

solve' k l m
  | l + m <= k - 1 = 1
  | l >= k = 1 + solve' k (l - k + 1) m
  | m >= k = 1 + solve' k l (m - k + 1)
  | otherwise = 2
