PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000081. Đếm các bội chung bán nguyên (Semi Common Multiple)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Đếm các bội chung bán nguyên (Semi Common Multiple)

Semi Common Multiple

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

You are given NN positive even integers A=(a1,a2,…,aN)A=(a_1,a_2,\ldots,a_N) and a positive integer MM. Call a positive integer XX a semi-common multiple if, for every index ii, some nonnegative integer pip_i satisfies X=ai(pi+12)X=a_i(p_i+\tfrac12). Count the integers XX in [1,M][1,M] that satisfy this condition.

Input

The first line contains N,MN,M. The next line contains the NN even integers a1,a2,…,aNa_1,a_2,\ldots,a_N.

Output

Print a single integer, the number of qualifying values XX.

Subtasks

  • Subtask 1 (20 points): 1≤N≤101\le N\le10, 1≤M≤1031\le M\le10^3, 2≤ai≤1002\le a_i\le100 và aia_i chẵn.

  • Subtask 2 (30 points): 1≤N≤1031\le N\le10^3, 1≤M≤1061\le M\le10^6, 2≤ai≤1062\le a_i\le10^6 và aia_i chẵn.

  • Subtask 3 (50 points): 1≤N≤1051\le N\le10^5, 1≤M≤1091\le M\le10^9, 2≤ai≤1092\le a_i\le10^9 và aia_i chẵn.

Examples

Input

2 50
6 10

Output

2

Explanation

The only qualifying values are 1515 and 4545. Indeed, 15=6(2+12)=10(1+12)15=6(2+\tfrac12)=10(1+\tfrac12) and 45=6(7+12)=10(4+12)45=6(7+\tfrac12)=10(4+\tfrac12). No other value in [1,50][1,50] works.