405842: GYM102134 C Maya's message

Memory Limit:64 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Maya's messagetime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard output

This is a well known fact that Maya's message regarding Apocalypse on 21 December 2012 has not happened. Perhaps, the issue was in a wrong way of the message decryption. Despite Maya's calendar is quite complicated, researchers have managed to compute the exact number of days before Apocalypse event.

Unfortunately, this number has two types of digits, i.e. some of the are easy readable, but some of them are quite blurred. Maya society used to have a cult of number of k during those days. Therefore, scientists are sure that number from their message is a multiple of k. So the government is quite worried about this message. Hence, the task is to find the minimal possible number, which could be mentioned by Maya.

Input

First line contains two integer numbers n and k — length of the message and cult number, respectively.

Second line contains the message, which has total n digits and "?" signs stand for clear and blurry symbols, respectively.

1  ≤ n, k ≤  1000.

Output

Single line should contain minimal possible number, which has exactly n digits – the message of Maya. Note, that ancient Maya don't like leading zeros in numbers. Therefore, there is no chance that the message contains any of them.

If it is impossible to recover the message under given constraints, the line should contain -1.

ExamplesInput
2 14
4?
Output
42
Input
2 17
4?
Output
-1

加入题单

上一题 下一题 算法标签: