toInt :: String -> Int
toInt = read :: String -> Int

getKthNumber :: String -> Int -> Int
getKthNumber s k
  | k == 1 = n
  | n == 1 = getKthNumber (tail s) (k - 1)
  | otherwise = n
      where
        n = toInt $ take 1 s

main = do
  s <- getLine
  k <- toInt <$> getLine
  putStrLn $ show $ getKthNumber s k
