cnt :: String -> (Int,Int)
cnt [] = (0,1)
cnt (n:ns) = if n =='1' then (1+ (fst (cnt ns)),1)
  else (1,read [n])

main :: IO ()
main = do
  ns <- getLine
  k <-readLn :: IO Int
  if fst( cnt ns )>= k then print 1 else print $ snd (cnt ns)
