AT_abc466_f [ABC466F] Many Mod Calculation
Description
You are given integers $ N,X $ and a length- $ N $ sequence of positive integers $ A=(A_1,A_2,\ldots,A_N) $ .
For a non-negative integer $ x $ , define $ f(x)=(\ldots((x \bmod A_1) \bmod A_2) \ldots ) \bmod A_N $ .
Find the number of integers $ x $ between $ 1 $ and $ X $ , inclusive, such that $ f(x)=0 $ .
You are given $ T $ test cases; solve each of them.
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ \text{case}_1 $ $ \text{case}_2 $ $ \vdots $ $ \text{case}_T $
Each test case is given in the following format:
> $ N $ $ X $ $ A_1 $ $ A_2 $ $ \ldots $ $ A_N $
Output Format
Output the answers for the test cases in order, separated by newlines.
Explanation/Hint
### Sample Explanation 1
Consider the first test case.
For example, when $ x=7 $ , $ f(7)=(((7 \bmod 5) \bmod 2)\bmod 3)=(2\bmod 2)\bmod 3=0\bmod 3=0 $ .
There are four integers $ x $ between $ 1 $ and $ 7 $ such that $ f(x)=0 $ : $ x=2,4,5,7 $ .
### Constraints
- $ 1\le T\le 2\times 10^5 $
- $ 1\le N\le 2\times 10^5 $
- The sum of $ N $ over all test cases is at most $ 2\times 10^5 $ .
- $ 1\le X\le 10^{18} $
- $ 1\le A_i\le 10^{18} $
- All input values are integers.