import Data.List
main=do
  s<-getLine
  k<-readLn::IO Int
  putStrLn $ if length s == 1
    then s
    else f s k

f s k
  | n1>=k = "1"
  | True = (:"") $ head $ dropWhile(=='1')s
    where n1 = length $ takeWhile(=='1')s
