#ABC150D. [ABC150D] Semi Common Multiple

[ABC150D] Semi Common Multiple

Score : 400400 points

Problem Statement

Given are a sequence A=a1,a2,......aNA= {a_1,a_2,......a_N} of NN positive even numbers, and an integer MM.

Let a semi-common multiple of AA be a positive integer XX that satisfies the following condition for every kk (1kN)(1 \leq k \leq N):

  • There exists a non-negative integer pp such that X=ak×(p+0.5)X= a_k \times (p+0.5).

Find the number of semi-common multiples of AA among the integers between 11 and MM (inclusive).

Constraints

  • 1N1051 \leq N \leq 10^5
  • 1M1091 \leq M \leq 10^9
  • 2ai1092 \leq a_i \leq 10^9
  • aia_i is an even number.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

a1a_1 a2a_2 ...... aNa_N

Output

Print the number of semi-common multiples of AA among the integers between 11 and MM (inclusive).

2 50
6 10
2
  • 15=6×2.515 = 6 \times 2.5
  • 15=10×1.515 = 10 \times 1.5
  • 45=6×7.545 = 6 \times 7.5
  • 45=10×4.545 = 10 \times 4.5

Thus, 1515 and 4545 are semi-common multiples of AA. There are no other semi-common multiples of AA between 11 and 5050, so the answer is 22.

3 100
14 22 40
0

The answer can be 00.

5 1000000000
6 6 2 6 2
166666667