| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 40 | 1 | 1 | 50.000% |
You are given a list $a$ that contains $n$ different positive integers, a positive integer $k,ドル and a positive integer~$\ell$. Find the smallest integer $x$ that is greater than or equal to $\ell$ and satisfies exactly one condition among the following ones:
The first line contains two integers $n$ and $k$ (1ドル \le n \le 10^5,ドル 2ドル \le k \le 10^5$).
The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ (1ドル \le a_i \le 10^{18}$).
The third line contains a single integer $\ell$ (1ドル \le \ell \le 10^{18}$).
Output a single integer, the answer to the problem.
5 9 181 182 184 178 81 173
183
1 888 888 888
888
In the sample, the integers 173,174,175,176,177,179,181,182ドル$ satisfy two conditions. The integer 178ドル$ satisfies three conditions. The integer 180ドル$ does not fulfill any conditions. Finally, the integer 183ドル$ satisfies exactly one condition: it is not divisible by 9ドル$.