def f(n):

    a=0

    while n%2==0:

        n//=2

        a+=1

    return a    

n,m,*a=list(map(int,open(0).read().split()))

c=[f(i) for i in a]

if sum(c)!=c[0]*n:

    print((0))

    exit()

import fractions

def lcm(x, y):

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

a=list(set(a))

a=[i//(2**c[0]) for i in a]

b=a[0]

for i in a:

    b=lcm(i,b)

    if b*(2**c[0])>2*m:

        print((0))

        exit()

b*=2**c[0]    

print((0 if b//2>m else (m-b//2)//b+1))  
n,m,*a=list(map(int,open(0).read().split()))

c=[bin(i)[::-1].index("1") for i in a]

if sum(c)!=c[0]*n:

    print((0))

    exit()

import fractions

def lcm(x, y):

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

a=list(set(a))

b=a[0]

for i in a:

    b=lcm(i,b)

    if b>2*m:

        print((0))

        exit()

print(((m-b//2)//b+1))  
def f(n):
    a = 0
    while n % 2 == 0:
        n //= 2
        a += 1
    return a


n, m, *a = list(map(int, open(0).read().split()))
c = [f(i) for i in a]
if sum(c) != c[0] * n:
    print((0))
    exit()
import fractions


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


a = list(set(a))
a = [i // (2 ** c[0]) for i in a]
b = a[0]
for i in a:
    b = lcm(i, b)
    if b * (2 ** c[0]) > 2 * m:
        print((0))
        exit()
b *= 2 ** c[0]
print((0 if b // 2 > m else (m - b // 2) // b + 1))

n, m, *a = list(map(int, open(0).read().split()))
c = [bin(i)[::-1].index("1") for i in a]
if sum(c) != c[0] * n:
    print((0))
    exit()
import fractions


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


a = list(set(a))
b = a[0]
for i in a:
    b = lcm(i, b)
    if b > 2 * m:
        print((0))
        exit()
print(((m - b // 2) // b + 1))

-def f(n): -    a = 0 -    while n % 2 == 0: -        n //= 2 -        a += 1 -    return a - - -c = [f(i) for i in a] +c = [bin(i)[::-1].index("1") for i in a] -a = [i // (2 ** c[0]) for i in a] -    if b * (2 ** c[0]) > 2 * m: +    if b > 2 * m: -b *= 2 ** c[0] -print((0 if b // 2 > m else (m - b // 2) // b + 1)) +print(((m - b // 2) // b + 1))