import Control.Applicative
import Control.Monad
import Data.List
import Data.Char
strToInt s = (read :: String -> Int) s
strToInteger s = (read :: String -> Integer) s
strToDouble s = (read :: String -> Double) s

main :: IO ()
main = do
    [n, k] <- words <$> getLine
    l <- getLine
    let likes = ['0'..'9'] \\ l
    -- 出力
    putStrLn $ solve likes n

solve :: String -> String -> String
solve likes n = if null $ head gts then c : replicate (length n) (head likes) else map (\list -> if null list then likes!!0 else head list) gts
    where gts = map (\x -> filter (>= x) likes) n
          c = if head likes == '0' then likes!!1 else likes!!0
