import fractions

from functools import reduce



def gcd(*numbers):

    return reduce(fractions.gcd, numbers)



def lcm_base(x, y):

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



def lcm(*numbers):

    return reduce(lcm_base, numbers, 1)

    

def factorization(n):

    arr = []

    temp = n

    for i in range(2, int(-(-n**0.5//1))+1):

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append([i, cnt])



    if temp!=1:

        arr.append([temp, 1])



    if arr==[]:

        arr.append([n, 1])



    return arr





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

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



#if gcd(*A) % 2 != 0:

    #print(0)

    #exit(0)



#sisu_2 = factorization(A[0])[0][1] 

sisu_2 = min([factorization(A[i])[0][1] for i in range(min(1000,N))])



#lcm_a = lcm(*A)

#lcm_a_half = lcm_a // 2

lcm_a = lcm(*A) // 2

'''

l = []

sisu_a0 = 0

for i in range(N):

    sisu = 0

    while A[i]%2==0:

        A[i] //= 2

        sisu += 1

    

    if sisu_a0==0:

        sisu_a0 = sisu

    else:

        if sisu_a0!=sisu:

            print(0)

            exit()

'''

if (lcm_a % (2**sisu_2) == 0) or lcm_a > M:

#factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M:

#if lcm_a > M:

    print((0))

    exit(0)

else:

    print((int((M-lcm_a) // (lcm_a*2) + 1)))
import fractions

from functools import reduce

 

def gcd(*numbers):

    return reduce(fractions.gcd, numbers)

 

def lcm_base(x, y):

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

 

def lcm(*numbers):

    return reduce(lcm_base, numbers, 1)

    

def factorization(n):

    arr = []

    temp = n

    for i in range(2, int(-(-n**0.5//1))+1):

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append([i, cnt])

 

    if temp!=1:

        arr.append([temp, 1])

 

    if arr==[]:

        arr.append([n, 1])

 

    return arr

 

 

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

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

 

#if gcd(*A) % 2 != 0:

    #print(0)

    #exit(0)

 

#sisu_2 = factorization(A[0])[0][1] 

 

#lcm_a = lcm(*A)

#lcm_a_half = lcm_a // 2

lcm_a = lcm(*A) // 2

 

l = []

sisu_a0 = 0

flag = 0

for i in range(N):

    sisu = 0

    while A[i]%2==0:

        A[i] //= 2

        sisu += 1

    

    if sisu_a0==0:

        sisu_a0 = sisu

    else:

        if sisu_a0!=sisu:

            flag = 1

#if (lcm_a % (2**sisu_2) == 0) or lcm_a > M:

#if factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M:

if flag == 1 or lcm_a > M:

    print((0))

    exit(0)

else:

    print((int((M-lcm_a) // (lcm_a*2) + 1)))
import fractions
from functools import reduce


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


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


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


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


N, M = list(map(int, input().split()))
A = sorted(list(map(int, input().split())))
# if gcd(*A) % 2 != 0:
# print(0)
# exit(0)
# sisu_2 = factorization(A[0])[0][1]
sisu_2 = min([factorization(A[i])[0][1] for i in range(min(1000, N))])
# lcm_a = lcm(*A)
# lcm_a_half = lcm_a // 2
lcm_a = lcm(*A) // 2
"""
l = []
sisu_a0 = 0
for i in range(N):
    sisu = 0
    while A[i]%2==0:
        A[i] //= 2
        sisu += 1
    if sisu_a0==0:
        sisu_a0 = sisu
    else:
        if sisu_a0!=sisu:
            print(0)
            exit()
"""
if (lcm_a % (2**sisu_2) == 0) or lcm_a > M:
    # factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M:
    # if lcm_a > M:
    print((0))
    exit(0)
else:
    print((int((M - lcm_a) // (lcm_a * 2) + 1)))

import fractions
from functools import reduce


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


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


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


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
# if gcd(*A) % 2 != 0:
# print(0)
# exit(0)
# sisu_2 = factorization(A[0])[0][1]
# lcm_a = lcm(*A)
# lcm_a_half = lcm_a // 2
lcm_a = lcm(*A) // 2
l = []
sisu_a0 = 0
flag = 0
for i in range(N):
    sisu = 0
    while A[i] % 2 == 0:
        A[i] //= 2
        sisu += 1
    if sisu_a0 == 0:
        sisu_a0 = sisu
    else:
        if sisu_a0 != sisu:
            flag = 1
# if (lcm_a % (2**sisu_2) == 0) or lcm_a > M:
# if factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M:
if flag == 1 or lcm_a > M:
    print((0))
    exit(0)
else:
    print((int((M - lcm_a) // (lcm_a * 2) + 1)))

-A = sorted(list(map(int, input().split()))) +A = list(map(int, input().split())) -sisu_2 = min([factorization(A[i])[0][1] for i in range(min(1000, N))]) -""" +flag = 0 -    while A[i]%2==0: +    while A[i] % 2 == 0: -    if sisu_a0==0: +    if sisu_a0 == 0: -        if sisu_a0!=sisu: -            print(0) -            exit() -""" -if (lcm_a % (2**sisu_2) == 0) or lcm_a > M: -    # factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M: -    # if lcm_a > M: +        if sisu_a0 != sisu: +            flag = 1 +# if (lcm_a % (2**sisu_2) == 0) or lcm_a > M: +# if factorization(lcm_a)[0][1] != sisu_2 or lcm_a_half > M: +if flag == 1 or lcm_a > M: