{"raw_statement":[{"iden":"problem statement","content":"Iroha is very particular about numbers. There are $K$ digits that she dislikes: $D_1, D_2, ..., D_K$.\nShe is shopping, and now paying at the cashier. Her total is $N$ yen (the currency of Japan), thus she has to hand at least $N$ yen to the cashier (and possibly receive the change).\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\nFind the amount of money that she will hand to the cashier."},{"iden":"constraints","content":"*   $1 ≦ N < 10000$\n*   $1 ≦ K < 10$\n*   $0 ≦ D_1 < D_2 < … < D_K≦9$\n*   ${D_1,D_2,...,D_K} ≠ {1,2,3,4,5,6,7,8,9}$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $K$\n$D_1$ $D_2$ … $D_K$"},{"iden":"sample input 1","content":"1000 8\n1 3 4 5 6 7 8 9"},{"iden":"sample output 1","content":"2000\n\nShe dislikes all digits except $0$ and $2$.\nThe smallest integer equal to or greater than $N=1000$ whose decimal notation contains only $0$ and $2$, is $2000$."},{"iden":"sample input 2","content":"9999 1\n0"},{"iden":"sample output 2","content":"9999"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}