import fractions

from functools import reduce

def lcm_base(x, y):

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



def lcm(*numbers):

    return reduce(lcm_base, numbers, 1)#数列に対しての最小公倍数



n,m = list(map(int,input().split()))

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

b = [x//2 for x in a]

c = 0

while True:

    if a[0]%2:

        for i in range(n):

            if a[i]%2 == 0:

                print((0))

                exit()

        break

    else:

        for i in range(n):

            if a[i]%2:

                print((0))

                exit()

            a[i]//=2

        c += 1



least = lcm(*b)

ans = ((m//least)+1)//2

print(ans)
import fractions

from functools import reduce





def lcm_base(x, y):

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





def lcm(*numbers):

    return reduce(lcm_base, numbers, 1)  # 数列に対しての最小公倍数





n, m = list(map(int, input().split()))

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

b = [x // 2 for x in a]

c = 0

while a[0] % (2 ** (c + 1)) == 0:

    c += 1



for x in a:

    if x % (2 ** c) != 0 or x % (2 ** (c + 1)) == 0:

        print((0))

        exit()



lc = lcm(*b)



ans = ((m // lc) + 1) // 2

print(ans)

import fractions
from functools import reduce


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


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)  # 数列に対しての最小公倍数


n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [x // 2 for x in a]
c = 0
while True:
    if a[0] % 2:
        for i in range(n):
            if a[i] % 2 == 0:
                print((0))
                exit()
        break
    else:
        for i in range(n):
            if a[i] % 2:
                print((0))
                exit()
            a[i] //= 2
        c += 1
least = lcm(*b)
ans = ((m // least) + 1) // 2
print(ans)

import fractions
from functools import reduce


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


def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)  # 数列に対しての最小公倍数


n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [x // 2 for x in a]
c = 0
while a[0] % (2 ** (c + 1)) == 0:
    c += 1
for x in a:
    if x % (2**c) != 0 or x % (2 ** (c + 1)) == 0:
        print((0))
        exit()
lc = lcm(*b)
ans = ((m // lc) + 1) // 2
print(ans)

-while True: -    if a[0] % 2: -        for i in range(n): -            if a[i] % 2 == 0: -                print((0)) -                exit() -        break -    else: -        for i in range(n): -            if a[i] % 2: -                print((0)) -                exit() -            a[i] //= 2 -        c += 1 -least = lcm(*b) -ans = ((m // least) + 1) // 2 +while a[0] % (2 ** (c + 1)) == 0: +    c += 1 +for x in a: +    if x % (2**c) != 0 or x % (2 ** (c + 1)) == 0: +        print((0)) +        exit() +lc = lcm(*b) +ans = ((m // lc) + 1) // 2