module Main where

import Control.Applicative
import Control.Monad
import Data.List (break)

solve :: String -> Int -> IO ()
solve ss k = do
    let (as, bs) = break (/= '1') ss
    if k <= (length as)
        then putStrLn "1"
        else putStrLn [head bs]

main :: IO ()
main = do
    ss <- getLine
    k <- readLn :: IO Int
    solve ss k