| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 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$.