import Data.Char
import Data.List
import Data.Maybe

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 = fromJust . findIndex (k<) $ suml
    print $ s!!(idx-1)
  where
    f a i =
        let i' = fromIntegral i
         in a + max ((5 * 10^16) * (i'-1)) 1