import qualified Data.Char as C main :: IO () main = do [n, k] <- fmap (map read . words) getLine :: IO [Int] let ix = [(10 ^ (n -1))..(10 ^ n - 1)] ix' = map (map C.digitToInt . show) ix result = take 1 $ filter (check (n - k - 2)) ix' putStrLn $ if length result == 0 then "-1" else foldr (\c a -> (show c) ++ " " ++ a) [] $ result !! 0 check :: Int -> [Int] -> Bool check 0 (_:_:[]) = True check _ (_:_:[]) = False check k' (a:b:c:xs) | k' < 0 = False | isKadomatsu = check (k'-1) (b:c:xs) | otherwise = check k' (b:c:xs) where isKadomatsu = a /= b && a /= c && b /= c && (a > b && c > b || a < b && c < b)