11473: HDU5339 - Untitled
[Creator : ]
Description
There is an integer $a$ and $n$ integers $b_1,…,b_n$. After selecting some numbers from $b_1,…,b_n$ in any order, say $c_1,…,c_r$, we want to make sure that $a \bmod c_1 \bmod c_2 \bmod … \mod c_r=0$ (i.e., $a$ will become the remainder divided by $c_i$ each time, and at the end, we want $a$ to become $0$).
Please determine the minimum value of $r$. If the goal cannot be achieved, print $-1$ instead.
Please determine the minimum value of $r$. If the goal cannot be achieved, print $-1$ instead.
Input
The first line contains one integer $T\ (T≤5)$, which represents the number of testcases.
For each testcase, there are two lines:
1. The first line contains two integers $n, a\ (1≤n≤20,\ 1≤a≤10^6)$.
2. The second line contains $n$ integers $b_1,…,b_n\ (\forall 1≤i≤n,\ 1≤b_i≤10^6)$.
For each testcase, there are two lines:
1. The first line contains two integers $n, a\ (1≤n≤20,\ 1≤a≤10^6)$.
2. The second line contains $n$ integers $b_1,…,b_n\ (\forall 1≤i≤n,\ 1≤b_i≤10^6)$.
Output
Print $T$ answers in $T$ lines.
Sample 1 Input
2
2 9
2 7
2 9
6 7
Sample 1 Output
2
-1