import Data.List
import Data.Maybe
main = do
    s <- getLine
    k <- readLn :: IO Integer
    let p = toInteger . fromJust $ findIndex (/='1') s
    putStrLn $ if k<=p then "1" else [genericIndex s p]