import sys

import numpy as np

from fractions import gcd

from functools import reduce



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N, M = lr()

A = np.array(lr())

B = A // 2

# Bの要素が全て2の同じ冪乗

# Bの最小公倍数を求める

def merge(a, b):

    g = gcd(a, b)

    a, b = a // g, b // g

    if a%2 == 0 or b%2 == 0:

        return 0

    ret = a * b * g

    if ret > 10 ** 9:

        return 0

    return ret



x = reduce(merge, B)

if x == 0:

    answer = 0

else:

    answer = M // x - M // (2*x)



print(answer)

# 56
import sys

from fractions import gcd



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



# A が2で何回割れるか

N, M = lr()

A = lr()

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

cnt = 0

while all(x%2 == 0 for x in A):

    cnt += 1

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



if any(x%2 == 0 for x in A):

    print((0)); exit()



lcm = 1

for a in A:

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



answer = M // (2 ** cnt * lcm) - M // (2 ** (cnt+1) * lcm)

print(answer)

# 21

import sys
import numpy as np
from fractions import gcd
from functools import reduce

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
A = np.array(lr())
B = A // 2
# Bの要素が全て2の同じ冪乗
# Bの最小公倍数を求める
def merge(a, b):
    g = gcd(a, b)
    a, b = a // g, b // g
    if a % 2 == 0 or b % 2 == 0:
        return 0
    ret = a * b * g
    if ret > 10**9:
        return 0
    return ret


x = reduce(merge, B)
if x == 0:
    answer = 0
else:
    answer = M // x - M // (2 * x)
print(answer)
# 56

import sys
from fractions import gcd

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# A が2で何回割れるか
N, M = lr()
A = lr()
A = [x // 2 for x in A]
cnt = 0
while all(x % 2 == 0 for x in A):
    cnt += 1
    A = [x // 2 for x in A]
if any(x % 2 == 0 for x in A):
    print((0))
    exit()
lcm = 1
for a in A:
    lcm *= a // gcd(lcm, a)
answer = M // (2**cnt * lcm) - M // (2 ** (cnt + 1) * lcm)
print(answer)
# 21

-import numpy as np -from functools import reduce +# A が2で何回割れるか -A = np.array(lr()) -B = A // 2 -# Bの要素が全て2の同じ冪乗 -# Bの最小公倍数を求める -def merge(a, b): -    g = gcd(a, b) -    a, b = a // g, b // g -    if a % 2 == 0 or b % 2 == 0: -        return 0 -    ret = a * b * g -    if ret > 10**9: -        return 0 -    return ret - - -x = reduce(merge, B) -if x == 0: -    answer = 0 -else: -    answer = M // x - M // (2 * x) +A = lr() +A = [x // 2 for x in A] +cnt = 0 +while all(x % 2 == 0 for x in A): +    cnt += 1 +    A = [x // 2 for x in A] +if any(x % 2 == 0 for x in A): +    print((0)) +    exit() +lcm = 1 +for a in A: +    lcm *= a // gcd(lcm, a) +answer = M // (2**cnt * lcm) - M // (2 ** (cnt + 1) * lcm) -# 56 +# 21