Conditions

시간 제한1초메모리 제한2048 MB

문제

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:

  • $x$ is in the list $a$;
  • $x$ is not divisible by $k$;
  • $x$ contains $7$ in its decimal representation.

입력

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.

힌트

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$.