import sys

input = sys.stdin.readline



def gcd(a, b):

    while b:

        a, b = b, a%b

    return a



def lcm(a, b):

    return a*b//gcd(a, b)



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

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

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

    

L = 1



for bi in b:

    L = lcm(L, bi)



flag = True



for i in range(N):

    if (L-b[i])%a[i]!=0:

        flag = False

    

if not flag:

    print((0))

    exit()

    

L2 = 1



for ai in a:

    L2 = lcm(L2, ai)



if L>M:

    print((0))

else:

    print(((M-L)//L2+1))
import sys

input = sys.stdin.readline



def gcd(a, b):

    while b:

        a, b = b, a%b

    return a



def lcm(a, b):

    return a*b//gcd(a, b)



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

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

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

cnt = [0]*N



for i in range(N):

    tmp = b[i]

    

    while tmp%2==0:

        tmp //= 2

        cnt[i] += 1



if len(set(cnt))!=1:

    print((0))

    exit()

    

L = 1



for bi in b:

    L = lcm(L, bi)



L2 = 1



for ai in a:

    L2 = lcm(L2, ai)



if L>M:

    print((0))

else:

    print(((M-L)//L2+1))

import sys

input = sys.stdin.readline


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai // 2 for ai in a]
L = 1
for bi in b:
    L = lcm(L, bi)
flag = True
for i in range(N):
    if (L - b[i]) % a[i] != 0:
        flag = False
if not flag:
    print((0))
    exit()
L2 = 1
for ai in a:
    L2 = lcm(L2, ai)
if L > M:
    print((0))
else:
    print(((M - L) // L2 + 1))

import sys

input = sys.stdin.readline


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


N, M = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [ai // 2 for ai in a]
cnt = [0] * N
for i in range(N):
    tmp = b[i]
    while tmp % 2 == 0:
        tmp //= 2
        cnt[i] += 1
if len(set(cnt)) != 1:
    print((0))
    exit()
L = 1
for bi in b:
    L = lcm(L, bi)
L2 = 1
for ai in a:
    L2 = lcm(L2, ai)
if L > M:
    print((0))
else:
    print(((M - L) // L2 + 1))

+cnt = [0] * N +for i in range(N): +    tmp = b[i] +    while tmp % 2 == 0: +        tmp //= 2 +        cnt[i] += 1 +if len(set(cnt)) != 1: +    print((0)) +    exit() -flag = True -for i in range(N): -    if (L - b[i]) % a[i] != 0: -        flag = False -if not flag: -    print((0)) -    exit()