import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  s <- getLine
  k <- (read::String -> Int) <$> getLine
  let one_length = length $ takeWhile ((==) '1') s
  if k <= one_length
    then putStrLn "1"
    else putStrLn [s !! one_length]