import Control.Monad
import Control.Applicative
import Data.List
import Data.Array
import Data.Maybe
import Data.Bits
import Data.Ord
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import Debug.Trace


listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)

getWords = getLine >>= return . words

readIntBS = fst . fromJust . BS.readInt


main :: IO ()
main = do
  s <- getLine
  k <- readLn :: IO Integer

  let c = fromIntegral $ length $ takeWhile (=='1') s

  putStrLn $ [
    if k <= c then
      '1'
    else
      s !! (fromIntegral c)
      ]

  return ()