Smallest Missing Multiple

No attempts yetTime limit1sMemory limit512 MB

Problem

You are given a set of integers AA. Find the smallest positive integer that does not belong to the set AA and is divisible by a fixed number kk.

Write a program that:

  • reads the set AA and the number kk from standard input,
  • computes the smallest positive integer that is not in AA and is divisible by kk,
  • prints the result to standard output.

Input

The first line contains two integers nn and kk (1n1061 ≤ n ≤ 10^6, 1k10121 ≤ k ≤ 10^{12}), separated by a single space. Here nn is the size (number of elements) of the set AA. The second line contains nn integers aia_i (1ai10181 ≤ a_i ≤ 10^{18}), separated by single spaces, representing the elements of the set AA. All aia_i are pairwise distinct.

Output

Print, on the first and only line, the smallest positive integer that does not belong to the set AA and is divisible by kk.