import fractions

from functools import reduce

import numpy as np

import sys



N, M = list(map(int, input().split()))

an = list(map(int, input().split()))





def lcm_base(x, y):

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





def gcd_list(numbers):

    return reduce(fractions.gcd, numbers)





def lcm_list(numbers):

    return reduce(lcm_base, numbers, 1)





def lcm(*numbers):

    return reduce(lcm_base, numbers, 1)





def listdivide(list):

    numpy = np.array(list)

    numpy = numpy//2

    return numpy.tolist()





def divide2(x):

    res = 0

    while x % 2 == 0:

        x /= 2

        res += 1

    return res





# while gcd_list(an) % 2 == 0:

#     print(gcd_list(an))

an = listdivide(an)



t = divide2(an[0])

for i in range(1, N):

    if divide2(an[i]) != t:

        print((0))

        sys.exit()



for i in range(t):

    an = listdivide(an)

    M = M // 2



LCM = lcm_list(an)



if LCM > M == 0:

    print((0))

else:

    print((-(-(M // LCM)//2)))

import sys

from fractions import gcd

N, M = list(map(int, input().split()))

an = list([int(x)//2 for x in input().split()])



lcm = an[0]

for a in an[1:]:

    l = lcm*a//gcd(lcm, a)

    if not (l//lcm % 2 == l//a % 2):

        print((0))

        sys.exit()

    lcm = l

print(((M//lcm+1)//2))
import fractions
from functools import reduce
import numpy as np
import sys

N, M = list(map(int, input().split()))
an = list(map(int, input().split()))


def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


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


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


def listdivide(list):
    numpy = np.array(list)
    numpy = numpy // 2
    return numpy.tolist()


def divide2(x):
    res = 0
    while x % 2 == 0:
        x /= 2
        res += 1
    return res


# while gcd_list(an) % 2 == 0:
#     print(gcd_list(an))
an = listdivide(an)
t = divide2(an[0])
for i in range(1, N):
    if divide2(an[i]) != t:
        print((0))
        sys.exit()
for i in range(t):
    an = listdivide(an)
    M = M // 2
LCM = lcm_list(an)
if LCM > M == 0:
    print((0))
else:
    print((-(-(M // LCM) // 2)))

import sys
from fractions import gcd

N, M = list(map(int, input().split()))
an = list([int(x) // 2 for x in input().split()])
lcm = an[0]
for a in an[1:]:
    l = lcm * a // gcd(lcm, a)
    if not (l // lcm % 2 == l // a % 2):
        print((0))
        sys.exit()
    lcm = l
print(((M // lcm + 1) // 2))

-import fractions -from functools import reduce -import numpy as np +from fractions import gcd -an = list(map(int, input().split())) - - -def lcm_base(x, y): -    return (x * y) // fractions.gcd(x, y) - - -def gcd_list(numbers): -    return reduce(fractions.gcd, numbers) - - -def lcm_list(numbers): -    return reduce(lcm_base, numbers, 1) - - -def lcm(*numbers): -    return reduce(lcm_base, numbers, 1) - - -def listdivide(list): -    numpy = np.array(list) -    numpy = numpy // 2 -    return numpy.tolist() - - -def divide2(x): -    res = 0 -    while x % 2 == 0: -        x /= 2 -        res += 1 -    return res - - -# while gcd_list(an) % 2 == 0: -#     print(gcd_list(an)) -an = listdivide(an) -t = divide2(an[0]) -for i in range(1, N): -    if divide2(an[i]) != t: +an = list([int(x) // 2 for x in input().split()]) +lcm = an[0] +for a in an[1:]: +    l = lcm * a // gcd(lcm, a) +    if not (l // lcm % 2 == l // a % 2): -for i in range(t): -    an = listdivide(an) -    M = M // 2 -LCM = lcm_list(an) -if LCM > M == 0: -    print((0)) -else: -    print((-(-(M // LCM) // 2))) +    lcm = l +print(((M // lcm + 1) // 2))