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

A = list(set(map(int, input().split())))



def gcd(m, n):

    if n == 0:

        return m

    return gcd(n, m % n)



LCM = A[0]

for a in A:

    LCM = LCM * a // gcd(LCM, a)



K = max(A)

for X in range(K // 2, M + 1, K):

    for a in A:

        if (X - a // 2) % a != 0:

            break

    else:

        print(((M - X) // LCM + 1))

        exit()

print((0))

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

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



B = set([a & (-a) for a in A])

if len(B) > 1:

    print((0))

    exit()



def gcd(n, m):

    if m == 0:

        return n

    return gcd(m, n % m)



def lcm(x, y):

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



A = [a // 2 for a in A]

LCM = A[0]

for a in A:

    LCM = lcm(LCM, a)



ans = ((M // LCM) + 1) // 2

print(ans)

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


def gcd(m, n):
    if n == 0:
        return m
    return gcd(n, m % n)


LCM = A[0]
for a in A:
    LCM = LCM * a // gcd(LCM, a)
K = max(A)
for X in range(K // 2, M + 1, K):
    for a in A:
        if (X - a // 2) % a != 0:
            break
    else:
        print(((M - X) // LCM + 1))
        exit()
print((0))

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = set([a & (-a) for a in A])
if len(B) > 1:
    print((0))
    exit()


def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)


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


A = [a // 2 for a in A]
LCM = A[0]
for a in A:
    LCM = lcm(LCM, a)
ans = ((M // LCM) + 1) // 2
print(ans)

-A = list(set(map(int, input().split()))) +A = list(map(int, input().split())) +B = set([a & (-a) for a in A]) +if len(B) > 1: +    print((0)) +    exit() -def gcd(m, n): -    if n == 0: -        return m -    return gcd(n, m % n) +def gcd(n, m): +    if m == 0: +        return n +    return gcd(m, n % m) +def lcm(x, y): +    return x * y // gcd(x, y) + + +A = [a // 2 for a in A] -    LCM = LCM * a // gcd(LCM, a) -K = max(A) -for X in range(K // 2, M + 1, K): -    for a in A: -        if (X - a // 2) % a != 0: -            break -    else: -        print(((M - X) // LCM + 1)) -        exit() -print((0)) +    LCM = lcm(LCM, a) +ans = ((M // LCM) + 1) // 2 +print(ans)