DEVIL Numbers

0

0 votes
Problem

There is one GOD number and N DEVIL numbers. We want to find how many numbers are there which exactly divide the GOD number, but does not divide any of the DEVIL numbers.

Input Format: The first line of input contains two numbers N and K seperated by spaces. N is the number of DEVIL numbers, K is the GOD number. The second line of input contains N space separated DEVIL numbers.

Output Format: Output the answer in a single line.

Constraints:

1 <= N <= 10^6

1 <= K <= 10^13

1 <= DEVIL numbers <= 10^18

Sample Input:

8 16

2 5 7 4 3 8 3 18

Sample Output:

1

Explanation :

Divisors of the given GOD number 16, are { 1, 2, 4, 8, 16 } and the DEVIL numbers are {2, 5, 7, 4, 3, 8, 3, 18}. Now 1 divides all DEVIL numbers, 2 divide 2, 4 divide 4, 8 divide 8 but 16 divides none of them. So only one number exists which divide the GOD number but does not divide any of the DEVIL numbers. So the answer is 1.

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?