import Data.Char
import Data.List

main :: IO ()
main = do
    s <- map (fromIntegral . digitToInt)
         . filter (not . isSpace) <$> getLine :: IO [Integer]
    k <- readLn :: IO Integer
    let suml = scanl f 0 s
        idx = findIndex (k<) suml
    print $ case idx of
        Just i  -> s!!(i-1)
        Nothing -> head s
  where
    f a i =
        let i' = fromIntegral i
         in a + max ((5 * 10^16) * (i'-1)) 1
