Time limit
2s
Memory limit
128 MB
You are given natural numbers N and K. Among all natural numbers greater than or equal to N, find the smallest number that uses exactly K distinct decimal digits.
The first line contains N and K separated by a space.
N is a natural number not greater than 10^18. K is a natural number not greater than 10.
Output the smallest natural number that satisfies the condition.