from functools import reduce

from fractions import gcd



N, M, *A = list(map(int, open(0).read().split()))



def lcm(x, y):

    return x * y // gcd(x, y)



def sub_by_2(n):

    cnt = 0

    while n % 2 == 0:

        n //= 2

        cnt += 1

    return cnt



lcm_2 = [sub_by_2(n // 2) for n in A]

if all(lcm_2[0] == v for v in lcm_2):

    num = reduce(lcm, [v // 2 for v in A])

    res = M // num

    print((res // 2 + res % 2))

else:

    print((0))

from math import gcd

from functools import reduce



N, M, *A = list(map(int, open(0).read().split()))



def lcm(x, y):

    return x * y // gcd(x, y)



def lcm_list(numbers):

    return reduce(lcm, numbers, 1)



def even_count(n):

    res = 0

    while n % 2 == 0:

        res += 1

        n //= 2

    return res





x = [v // 2 for v in A]

if all(even_count(v) == even_count(x[0]) for v in x):

    num = lcm_list(x)

    print((-(-(M // num) // 2)))

else:

    print((0))



from functools import reduce
from fractions import gcd

N, M, *A = list(map(int, open(0).read().split()))


def lcm(x, y):
    return x * y // gcd(x, y)


def sub_by_2(n):
    cnt = 0
    while n % 2 == 0:
        n //= 2
        cnt += 1
    return cnt


lcm_2 = [sub_by_2(n // 2) for n in A]
if all(lcm_2[0] == v for v in lcm_2):
    num = reduce(lcm, [v // 2 for v in A])
    res = M // num
    print((res // 2 + res % 2))
else:
    print((0))

from math import gcd
from functools import reduce

N, M, *A = list(map(int, open(0).read().split()))


def lcm(x, y):
    return x * y // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def even_count(n):
    res = 0
    while n % 2 == 0:
        res += 1
        n //= 2
    return res


x = [v // 2 for v in A]
if all(even_count(v) == even_count(x[0]) for v in x):
    num = lcm_list(x)
    print((-(-(M // num) // 2)))
else:
    print((0))

+from math import gcd -from fractions import gcd -def sub_by_2(n): -    cnt = 0 -    while n % 2 == 0: -        n //= 2 -        cnt += 1 -    return cnt +def lcm_list(numbers): +    return reduce(lcm, numbers, 1) -lcm_2 = [sub_by_2(n // 2) for n in A] -if all(lcm_2[0] == v for v in lcm_2): -    num = reduce(lcm, [v // 2 for v in A]) -    res = M // num -    print((res // 2 + res % 2)) +def even_count(n): +    res = 0 +    while n % 2 == 0: +        res += 1 +        n //= 2 +    return res + + +x = [v // 2 for v in A] +if all(even_count(v) == even_count(x[0]) for v in x): +    num = lcm_list(x) +    print((-(-(M // num) // 2)))