Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.
Let a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):
 - There exists a non-negative integer p such that X= a_k \times (p+0.5).
Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

-----Constraints-----
 - 1 \leq N \leq 10^5
 - 1 \leq M \leq 10^9
 - 2 \leq a_i \leq 10^9
 - a_i is an even number.
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N M
a_1 a_2 ... a_N

-----Output-----
Print the number of semi-common multiples of A among the integers between 1 and M (inclusive).

-----Sample Input-----
2 50
6 10

-----Sample Output-----
2

 - 15 = 6  \times 2.5 
 - 15 = 10 \times 1.5 
 - 45 = 6  \times 7.5 
 - 45 = 10 \times 4.5 
Thus, 15 and 45 are semi-common multiples of A. There are no other semi-common multiples of A between 1 and 50, so the answer is 2.

Difficulty: MEDIUM

Solutions:
import math
from functools import reduce
(N, M) = list(map(int, input().split()))
A = [int(x) // 2 for x in input().split()]

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

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)
LCM = lcm(*A)
for a in A:
	if LCM // a % 2 == 0:
		print(0)
		break
else:
	print((M // LCM + 1) // 2)


import math
from functools import reduce

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

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

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)

def my_round(val, digit=0):
	p = 10 ** digit
	return (val * p * 2 + 1) // 2 / p
(n, m) = list(map(int, input().split()))
a_pr = [i // 2 for i in list(map(int, input().split()))]
lcm_ = lcm_list(a_pr)
(res, div2) = (0, None)
for ai in a_pr:
	cnt = 0
	while ai % 2 == 0:
		ai //= 2
		cnt += 1
	if div2 is None:
		div2 = cnt
	elif cnt != div2:
		print(0)
		return
print(int(my_round(m // lcm_ / 2)))


from math import gcd, ceil

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
	a[i] = a[i] // 2
lcm_v = a[0]
for i in range(1, n):
	lcm_v = lcm(lcm_v, a[i])
ok = True
for aa in a:
	if lcm_v // aa % 2 != 1:
		ok = False
		break
ans = 0
if ok:
	ans = (m // lcm_v + 1) // 2
print(ans)


from math import gcd
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
memo = {}

def lcm(a, b):
	return a // gcd(a, b) * b
b = 1
for a in A:
	b = lcm(a // 2, b)
	if b > M:
		break
if any([2 * b // a % 2 == 0 for a in A]):
	print(0)
else:
	ans = M // b
	print(ans - ans // 2)


import queue
import numpy as np
import math
(N, M) = map(int, input().split())
a2 = list(map(int, input().split()))
a = []
for i in a2:
	a.append(i // 2)
lcm = a[0]
for i in a:
	lcm *= i // math.gcd(lcm, i)
hasAns = True
for i in a:
	if lcm // i % 2 == 0:
		hasAns = False
		break
ans = 0
if hasAns:
	ans = (M // lcm + 1) // 2
print(ans)


import math

def LCM(a, b):
	g = math.gcd(a, b)
	return a * b // g
(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list(set(A))
N = len(A)
a0 = A[0]
div = 1
while a0 % 2 == 0:
	div *= 2
	a0 //= 2
for i in range(1, N):
	a = A[i] % div
	b = A[i] // div
	if b % 2 == 0 or a != 0:
		print(0)
		return
for i in range(N):
	A[i] //= 2
if N > 1:
	lcm = LCM(A[0], A[1])
	for i in range(2, N):
		lcm = LCM(lcm, A[i])
if N == 1:
	lcm = A[0]
ans = M // lcm
if ans % 2 == 1:
	print(ans // 2 + 1)
else:
	print(ans // 2)


from math import gcd

def readinput():
	(n, m) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	return (n, m, a)

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

def main(n, m, a):
	x = a[0] // 2
	for i in range(1, n):
		x = lcm(x, a[i] // 2)
	gusubai = False
	kisubai = False
	for i in range(n):
		if x % a[i] != 0:
			gusubai = True
		else:
			kisubai = True
	y = m // x
	if gusubai and (not kisubai):
		ans = y // 2 + y % 2
	elif gusubai and kisubai:
		ans = 0
	else:
		ans = y
	return ans

def __starting_point():
	(n, m, a) = readinput()
	ans = main(n, m, a)
	print(ans)
__starting_point()


from functools import reduce

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

def lcm(a, b):
	return a * b // gcd(a, b)
(N, M) = map(int, input().split())
A = [int(a) // 2 for a in input().split()]
B = [a & -a for a in A]
if min(B) != max(B):
	print(0)
else:
	l = reduce(lcm, A)
	print(M // l - M // l // 2)


import sys, math
r = sys.stdin.readline

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while b > 0:
		(a, b) = (b, a % b)
	return a

def lcm(arr):
	while len(arr) != 1:
		a = arr.pop()
		b = arr.pop()
		c = gcd(a, b)
		arr.insert(0, int(a * b / c))
	return arr[0]

def cnt2(num):
	cnt = 0
	while num % 2 == 0:
		num /= 2
		cnt += 1
	return cnt
(N, M) = list(map(int, r().split()))
seq = list(map(int, r().split()))
seq = list(set(seq))
tmp = cnt2(seq[0])
for num in seq:
	if tmp != cnt2(num):
		print(0)
		return
T = lcm(list([x // 2 for x in seq]))
if T > M:
	print(0)
	return
print(math.floor(M // T / 2 + 0.5))


import math
import numpy as np
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
c = 1
test = A[0]
l = 0
while test % 2 == 0:
	test = test // 2
	c *= 2
for i in np.arange(N - 1):
	if A[i + 1] % c != 0:
		print(0)
		l = 1
		break
	elif A[i + 1] % (c * 2) == 0:
		print(0)
		l = 1
		break
	else:
		k = A[i + 1] // c
		test = test * k // math.gcd(test, k)
if l == 0:
	k = test * c // 2
	print(M // k // 2 + M // k % 2)


import numpy as np
from math import ceil
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a = [x // 2 for x in a]
lcm = np.lcm.reduce(a)
ans = 0
for i in a:
	if lcm // i % 2 == 0:
		break
else:
	ans = ceil(m // lcm / 2)
print(ans)


from math import gcd, ceil
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a = [i // 2 for i in a]
l = 1
for i in a:
	l *= i // gcd(l, i)
for i in a:
	if l // i % 2 == 0:
		print(0)
		return
print(ceil(m // l / 2))


from math import gcd
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a = list(set(a))
a = list(map(lambda x: x // 2, a))

def lcm(q):
	x = q[0]
	for i in range(1, len(q)):
		x = x * q[i] // gcd(x, q[i])
	return x
lcma = lcm(a)
for i in range(len(a)):
	if lcma // a[i] % 2 == 0:
		print(0)
		exit()
temp = m // lcma
print(-(-temp // 2))


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

def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)
now = a[0]
for i in range(1, n):
	now = lcm(now, a[i])
	if now > 2 * m:
		print(0)
		exit(0)
for i in range(n):
	if now // a[i] % 2 == 0:
		print(0)
		exit(0)
print((m // (now // 2) + 1) // 2)


from functools import reduce
import math

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

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

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
a = [i // 2 for i in list(set(a))]
nothing = False
cnt_common = -1
for i in a:
	cnt = 0
	while i % 2 == 0:
		i = i // 2
		cnt += 1
	if cnt_common == -1:
		cnt_common = cnt
		continue
	if cnt_common != cnt:
		nothing = True
		break
b = lcm_list(a)
if nothing:
	print(0)
else:
	ans = (m - b) // (2 * b) + 1
	print(max(ans, 0))


(N, M) = map(int, input().split())
a = list(map(int, input().split()))
for k in range(N):
	a[k] //= 2
foo = 1
while a[0] % 2 == 0:
	foo *= 2
	a[0] //= 2
for k in range(1, N):
	if a[k] % foo == 0 and a[k] % (2 * foo) != 0:
		a[k] //= foo
		continue
	else:
		print(0)
		return
ans = 0
import math
lcm = a.pop()
for k in range(1, N):
	b = a.pop()
	lcm = lcm * b // math.gcd(lcm, b)
	if lcm * foo > M:
		print(0)
		return
lcm *= foo
ans = int((M / lcm - 1) // 2 + 1)
print(ans)


import math
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
LCM = A[0]
for i in range(1, N):
	LCM = LCM * A[i] // math.gcd(LCM, A[i])
for i in range(N):
	temp = LCM // A[i]
	if temp % 2 == 0:
		print(0)
		exit()
MIN = LCM // 2
nokori = M - MIN
ans = nokori // LCM + 1
print(ans)


def solve():
	import math
	(N, M) = [int(i) for i in input().split()]
	A = list(map(int, input().split()))
	lcm = A[0]
	for i in range(1, N):
		lcm = lcm * A[i] // math.gcd(lcm, A[i])
	first = lcm // 2
	ans_exists = True
	for i in range(N):
		if first % A[i] == 0:
			ans_exists = False
	if ans_exists:
		ans = int((M - first) // lcm + 1)
		print(ans)
	else:
		print('0')

def __starting_point():
	solve()
__starting_point()


from math import gcd
(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
lcm = 1
for a in A:
	lcm = lcm * a // gcd(lcm, a)
	if lcm > M * 2:
		print(0)
		return
for a in A:
	if lcm // a % 2 == 0:
		print(0)
		return
ans = M // (lcm // 2) - M // lcm
print(ans)


(n, m) = map(int, input().split())
l = list(map(int, input().split()))
g = l.copy()
while not any((x % 2 for x in g)):
	g = [x // 2 for x in g]
if not all((x % 2 for x in g)):
	print(0)
	exit(0)

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
lcm = lambda a, b: a * b // gcd(a, b)
tot = 1
for x in l:
	tot = lcm(tot, x // 2)
print((m // tot + 1) // 2)


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce, lru_cache

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def TUPLE():
	return tuple(map(int, input().split()))

def ZIP(n):
	return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 6
mod = 998244353
(N, M) = MAP()
a = LIST()
A = sorted([x // 2 for x in a], reverse=True)
lcm = A[-1]
for x in A:
	lcm = lcm * x // gcd(lcm, x)
r = lcm // A[0]
n = M // A[0]
for x in A:
	if lcm // x % 2 == 0:
		print(0)
		return
if r % 2 == 0:
	print(0)
else:
	print(n // r - n // (2 * r))


from fractions import *
(n, m, *a) = map(int, open(0).read().split())
s = 1
d = set()
for i in a:
	i //= 2
	s *= i // gcd(s, i)
	t = 0
	while i % 2 < 1:
		t += 1
		i //= 2
	d |= {t}
print((0 - -(m // s) // 2) * (len(d) < 2))


def a():
	(N, M) = map(int, input().split())
	B = list(map(lambda x: int(x) // 2, input().split()))

	def gcd(n, m):
		while n:
			(m, n) = [n, m % n]
		return m
	su = 1
	for b in B:
		su *= b // gcd(su, b)
		if su > M:
			return 0
	for _ in filter(lambda x: su // x % 2 == 0, B):
		return 0
	return M // su - M // (su * 2)
print(a())


(N, M) = map(int, input().split(' '))
a = list(set(map(int, input().split(' '))))
g = a.copy()
while not any((x % 2 for x in g)):
	g = [i // 2 for i in g]
if not all((x % 2 for x in g)):
	print(0)
	exit(0)

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

def lcm(a, b):
	return a * b // gcd(a, b)
tot = 1
for x in a:
	tot = lcm(tot, x // 2)
print((M // tot + 1) // 2)


from math import gcd, ceil
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
A = [a // 2 for a in A]
B = 1
for a in A:
	B *= a // gcd(B, a)
for a in A:
	if B // a % 2 == 0:
		print(0)
		return
print(ceil(M // B / 2))


def gcd_e(x, y):
	if y == 0:
		return x
	else:
		return gcd_e(y, x % y)

def lcm(x, y):
	return x * y // gcd_e(x, y)
(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
(a, b) = (A[0], 0)
for i in range(1, n):
	b = A[i]
	a = lcm(a, b)
for i in set(A):
	if a // i % 2 == 0:
		print('0')
		exit()
if a // 2 > m:
	print('0')
else:
	print((m - a // 2) // a + 1)


(N, M) = 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)


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

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for y in a:
	x = lcm(x, y // 2)
for y in a:
	if x // (y // 2) % 2 == 0:
		print(0)
		exit()
max_n = (m - x) // (2 * x)
print(max_n + 1)


def gcd(x, y):
	if x == 0:
		return y
	return gcd(y % x, x)
lcm = lambda x, y: x * y // gcd(x, y)
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
arr = [e // 2 for e in arr]
cm = arr[0]
for e in arr[1:]:
	cm = lcm(cm, e)
if any([cm // e % 2 == 0 for e in arr]):
	print(0)
	exit()
print((m // cm + 1) // 2)


(N, M) = map(int, input().split())
a = list(map(int, input().split()))
for k in range(N):
	a[k] //= 2
foo = 1
while a[0] % 2 == 0:
	foo *= 2
	a[0] //= 2
for k in range(1, N):
	if a[k] % foo == 0 and a[k] % (2 * foo) != 0:
		a[k] //= foo
		continue
	else:
		print(0)
		return
ans = 0
for odd in [3, 5, 7, 11]:
	flag = False
	for k in range(N):
		if a[k] % odd == 0:
			a[k] //= odd
			flag = True
	if flag:
		foo *= odd
import math
lcm = a.pop()
for k in range(1, N):
	b = a.pop()
	lcm = lcm * b // math.gcd(lcm, b)
	if lcm * foo > M:
		print(0)
		return
lcm *= foo
ans = int((M / lcm - 1) // 2 + 1)
print(ans)


from math import gcd, ceil
from functools import reduce
import sys

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

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
(N, M) = map(int, input().split())
a = [int(i) // 2 for i in input().split()]
s = set()
for x in a:
	cur = 0
	y = x
	while y % 2 == 0:
		cur += 1
		y //= 2
	s.add(cur)
	if len(s) >= 2:
		print(0)
		return
lcm = lcm_list(a)
print((M // lcm + 1) // 2)


import sys
import math
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

def read_str():
	return sys.stdin.readline().strip()

def read_int():
	return int(sys.stdin.readline().strip())

def read_ints():
	return map(int, sys.stdin.readline().strip().split())

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

def read_int_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

def Main():
	(n, m) = read_ints()
	a = read_int_list()
	a = [x // 2 for x in a]
	lcm = 1
	for x in a:
		lcm *= x // math.gcd(lcm, x)
	for x in a:
		if lcm // x % 2 == 0:
			print(0)
			return
	print(math.ceil(m // lcm / 2))

def __starting_point():
	Main()
__starting_point()


import sys
from math import gcd
from copy import deepcopy
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

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

def resolve():
	(n, m) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	A_ = deepcopy(A)
	cnt = [0] * n
	for i in range(n):
		while A_[i] % 2 == 0:
			A_[i] //= 2
			cnt[i] += 1
		if i != 0 and cnt[i] != cnt[i - 1]:
			print(0)
			return
	L = 1
	for a in A:
		L = lcm(L, a // 2)
	res = m // L - m // (L * 2)
	print(res)

def __starting_point():
	resolve()
__starting_point()


from math import gcd
from functools import reduce
import sys
input = sys.stdin.readline

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

def count_factor_2(num):
	count = 0
	while num % 2 == 0:
		num //= 2
		count += 1
	return count

def main():
	(n, m) = list(map(int, input().split()))
	A = list([x // 2 for x in set(map(int, input().split()))])
	check = len(set(map(count_factor_2, A)))
	if check != 1:
		print(0)
		return
	lcm_a = reduce(lcm, A)
	step = lcm_a * 2
	ans = (m + lcm_a) // step
	print(ans)

def __starting_point():
	main()
__starting_point()


from math import gcd
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
B = [a // 2 for a in A]
LCM = 1
for i in range(N):
	LCM = LCM * B[i] // gcd(LCM, B[i])
for i in range(N):
	if LCM // B[i] % 2 == 0:
		print(0)
		exit()
print((M // LCM + 1) // 2)


def gcd(a, b):
	if b == 0:
		return a
	r = a % b
	return gcd(b, r)

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

def gcdN(a):
	x = a[0]
	for i in range(1, len(a)):
		x = gcd(x, a[i])
	return x

def lcmN(a):
	x = a[0]
	for i in range(1, len(a)):
		x = lcm(x, a[i])
	return x
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
g = gcdN(a)
for i in a:
	if i // g % 2 == 0:
		print(0)
		break
else:
	l = lcmN(a)
	k = 2 * m // l
	print((k + 1) // 2)


def abc150_d():
	(n, m) = (int(x) for x in input().split())
	A = [int(x) // 2 for x in input().split()]
	from math import gcd

	def lcm(a, b):
		return a * b // gcd(a, b)
	x = 1
	for a in A:
		x = lcm(x, a)
	valid = True
	for a in A:
		if x // a % 2 == 0:
			valid = False
			break
	if valid:
		ans = (m // x + 1) // 2
	else:
		ans = 0
	print(ans)

def __starting_point():
	abc150_d()
__starting_point()


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m) = map(int, input().split())
arr = list(map(int, input().split()))
if n == 1:
	l = arr[0]
else:
	l = lcm(arr[0], arr[1])
for i in range(2, n):
	l = lcm(l, arr[i])
	if l // 2 > m:
		print(0)
		exit()
for i in range(n):
	if l // arr[i] % 2 == 0:
		print(0)
		exit()
ans = (m - l // 2) // l + 1
print(ans)


from math import gcd

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

def lcm(ab):
	l = len(ab)
	ret = ab[0]
	for i in range(1, l):
		ret = ret // gcd(ab[i], ret) * ab[i]
	return ret

def count2(a):
	ret = 0
	while a % 2 == 0:
		a //= 2
		ret += 1
	return 2 ** ret
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
if any((i % 2 for i in A)):
	print(0)
	return
A = [i // 2 for i in A]
p = lcm(A)
c = count2(p)
if any((i % c for i in A)):
	print(0)
	return
x = m // p
print(-(-x // 2))


from math import gcd

def lcm(a, b):
	return a // gcd(a, b) * b
(N, M) = map(int, input().split())
As = list(map(int, input().split()))
rightmostbit = As[0] & -As[0]
for A in As[1:]:
	if rightmostbit != A & -A:
		print(0)
		return
lcm_of_half_As = 1
for A in As:
	lcm_of_half_As = lcm(lcm_of_half_As, A // 2)
	if lcm_of_half_As > M:
		break
print((M // lcm_of_half_As + 1) // 2)


from math import gcd
(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [a // 2 for a in A]
lcm = 1
for i in range(n):
	lcm = lcm * A[i] // gcd(lcm, A[i])
	if lcm > m:
		print(0)
		return
for a in A:
	if lcm // a % 2 == 0:
		print(0)
		return
print((m // lcm + 1) // 2)


def main():
	import math
	(n, m) = list(map(int, input().split()))
	a = sorted(list(map(int, input().split())))
	for i in range(n):
		a[i] //= 2
	g = 1
	for i in range(n):
		g = a[i] * g // math.gcd(g, a[i])
	for i in range(n):
		if g // a[i] % 2 == 0:
			print(0)
			return
	if g > m:
		print(0)
		return
	print(1 + (m - g) // (2 * g))

def __starting_point():
	main()
__starting_point()


from math import gcd
(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [i // 2 for i in A]
lcd = 1
for a in A:
	lcd *= a // gcd(lcd, a)
for a in A:
	if lcd // a % 2 == 0:
		print(0)
		return
print((M // lcd + 1) // 2)


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

def f(a_k):
	count = 0
	while a_k % 2 == 0:
		count += 1
		a_k = a_k // 2
	return count
b = []
f_0 = f(a[0])
for a_k in a:
	f_k = f(a_k)
	if f_k != f_0:
		print(0)
		return
	b.append(a_k // pow(2, f_k))
import math

def lcm(x, y):
	return x * y // math.gcd(x, y)
b_lcm = 1
for b_k in b:
	b_lcm = lcm(b_lcm, b_k)
a_lcm = b_lcm * pow(2, f_0)
print((m + a_lcm // 2) // a_lcm)


(n, m) = map(int, input().split())
aas = set(list(map(int, input().split())))
a = [i // 2 for i in aas]
import math
N = len(a)

def n_of_twos(x):
	res = 0
	while x % 2 ** (res + 1) == 0:
		res += 1
	return res
if N >= 2:
	n_of_twos_0 = n_of_twos(a[0])
	for i in range(1, N):
		if n_of_twos(a[i]) != n_of_twos_0:
			print(0)
			return
ans = a[0]
for i in range(1, N):
	ans = ans * a[i] // math.gcd(ans, a[i])
if ans > m:
	print(0)
	return
print(1 + (m // ans - 1) // 2)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
l = [0] * n
for i in range(n):
	tmp = a[i]
	while tmp % 2 == 0:
		tmp //= 2
		l[i] += 1
	if i > 0 and l[i] != l[i - 1]:
		print(0)
		return
res = 1
for i in range(n):
	res = lcm(res, a[i] // 2)
print(m // res - m // (res * 2))


import math

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

def f(num):
	cnt = 0
	while num % 2 == 0:
		num = num // 2
		cnt += 1
	return cnt
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
	a[i] = a[i] // 2
t = f(a[0])
for i in range(n):
	if f(a[i]) != t:
		print(0)
		return
	a[i] = a[i] >> t
m = m >> t
l = 1
for i in range(n):
	l = lcm(l, a[i])
	if l > m:
		print(0)
		return
m = m // l
print((m + 1) // 2)


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

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

def lcm(a, b):
	return a * b // gcd(a, b)
l = a[0] // 2
ll = a[0]
for i in range(1, n):
	if a[i] % 2:
		odd = True
	else:
		even = True
	l = lcm(l, a[i] // 2)
	ll = lcm(ll, a[i])
	if l > m:
		print(0)
		exit()
for i in range(n):
	if l % a[i] == 0:
		print(0)
		exit()
print((m - l) // ll + 1)


(N, M) = map(int, input().split())
A = list(map(int, input().split()))
import sys
from math import gcd

def lcm(a, b):
	return a // gcd(a, b) * b
ans = 0
L = 1
for i in range(N):
	L = lcm(L, A[i])
	if L > 2 * M:
		print(0)
		sys.exit()
L2 = L
L1 = L // 2
for a in A:
	if L // a & 1 == 0:
		print(0)
		sys.exit()
ans = M // L1 - M // L2
print(ans)


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

def div_ceil(x, y):
	return (x + y - 1) // y
(N, M) = map(int, input().split())
(*A,) = map(int, input().split())
A = list(set([a // 2 for a in A]))
L = A[0]
for a in A[1:]:
	L *= a // gcd(L, a)
for a in A:
	if L // a % 2 == 0:
		ans = 0
		break
else:
	ans = div_ceil(M // L, 2)
print(ans)


import math
from decimal import Decimal, ROUND_HALF_UP

def lcm(a):
	x = a[0]
	for i in range(1, len(a)):
		x = x * a[i] // math.gcd(x, a[i])
	return x

def gcd(a):
	temp = math.gcd(a[0], a[1])
	for i in a:
		temp = math.gcd(temp, i)
	return temp
(n, m) = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
zero = False
count = 0
mini = lcm(a)
if len(a) != 1:
	maxi = gcd(a)
else:
	maxi = a[0]
maxi2 = maxi
nibai = 1
while True:
	if maxi2 % 2 == 0:
		nibai *= 2
		maxi2 //= 2
	else:
		break
for i in a:
	if i % (2 * nibai) == 0:
		zero = True
		break
if not zero:
	t = Decimal(str(m * 2 // mini / 2))
	print(t.quantize(Decimal('0'), rounding=ROUND_HALF_UP))
else:
	print(0)


from math import gcd

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

def cnt(x):
	i = 0
	while x % 2 == 0:
		x = x // 2
		i += 1
	return i
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
memo = cnt(a[0])
for i in range(n):
	if cnt(a[i]) != memo:
		print(0)
		return
	a[i] = a[i] // 2
t = 1
for i in range(n):
	t = lcm(t, a[i])
print(m // t - m // (2 * t))


from math import gcd
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
g = A[0]
check = g & -g
for a in A:
	if check != a & -a:
		check = -1
		break
	g = g * a // gcd(a, g)
if check >= 0:
	g //= 2
	print((M // g + 1) // 2)
else:
	print(0)


import sys

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(n, m) = map(int, input().split())
a = tuple(map(int, input().split()))
lcm = 1
for i in a:
	lcm = lcm * i // gcd(lcm, i)
for i in a:
	if lcm // i % 2 == 0:
		print(0)
		sys.exit()
print((m + lcm // 2) // lcm)


import math
from functools import reduce

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

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

def div2_n(x):
	n = 0
	while x % 2 == 0:
		if x % 2 == 0:
			n += 1
			x >>= 1
	return n
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
a2 = [i // 2 for i in a]
n0 = div2_n(a2[0])
for i in range(1, n):
	if div2_n(a2[i]) != n0:
		print(0)
		return
a2_l = lcm(*a2)
print(m // a2_l - m // (a2_l * 2))


import math
(N, M) = map(int, input().split())
nums = list(map(int, input().split()))
lcm = 1
b_cnt = -1
for num in nums:
	lcm = lcm * (num // 2) // math.gcd(lcm, num // 2)
	count = 0
	while num % 2 == 0:
		count += 1
		num //= 2
	if b_cnt < 0:
		b_cnt = count
	elif count != b_cnt:
		print(0)
		exit()
print((M + lcm) // (lcm * 2))


(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
	a[i] = a[i] // 2

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

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

def check(x):
	cnt = 0
	while 1:
		if x % 2 == 0:
			x = x // 2
			cnt += 1
		else:
			break
	return cnt
cnt = a[0]
for i in range(n):
	cnt = lcm(cnt, a[i])
l = check(a[0])
for i in range(1, n):
	x = check(a[i])
	if x != l:
		print(0)
		return
s = m // cnt
if s % 2 == 0:
	print(s // 2)
else:
	print(s // 2 + 1)


from collections import deque, defaultdict

def gcd(a, b):
	return b if not a % b else gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m) = list(map(int, input().split()))
A = [int(i) for i in input().split()]
tmp = A[0]
for i in range(1, n):
	tmp = lcm(tmp, A[i])
ans = m // tmp
lis = set()
for i in A:
	r = i
	k = 0
	while r % 2 == 0:
		k += 1
		r //= 2
	lis.add(k)
if m // tmp * tmp + tmp // 2 <= m:
	ans += 1
if len(lis) != 1:
	ans = 0
print(ans)


import math

def n_2(n):
	c = 0
	while n % 2 == 0:
		c += 1
		n >>= 1
	return (n, c)
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
(A[0], a) = n_2(A[0])
p = False
for i in range(1, N):
	(A[i], b) = n_2(A[i])
	if a != b:
		p = True
		break
if p:
	print(0)
	exit()
n = 1
for _ in range(a - 1):
	n *= 2
l = n
for a in A:
	l = l * a // math.gcd(l, a)
ans = M // l - M // (2 * l)
print(ans)


import fractions
import sys
input = sys.stdin.readline

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
g = a[0]
for i in range(1, n):
	g = g * a[i] // gcd(g, a[i])
for i in a:
	if g // 2 % i == 0:
		print(0)
		exit()
print(-(-(m * 2 // g) // 2))


(n, m) = map(int, input().split())
a = list(map(int, input().split()))
import math
lcm = 1
for i in range(n):
	b = a[i] // 2
	lcm = lcm * b // math.gcd(lcm, b)
if any((2 * lcm // i % 2 == 0 for i in a)):
	print(0)
else:
	print((m - lcm) // (2 * lcm) + 1)


import math
import sys
from functools import reduce
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
	A[i] = A[i] // 2

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

def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
C = lcm_list(A)
B = [0 for _ in range(N)]
for i in range(N):
	B[i] = C // A[i]
	if B[i] % 2 == 0:
		print(0)
		return
print((M // C + 1) // 2)


import math
from functools import reduce
(n, m) = map(int, input().split())
A = list(map(int, input().split()))

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

def lcm(target_list):
	return reduce(lcm_base, target_list)
A_gcd = reduce(math.gcd, A)
flg = True
for a in A:
	if a // A_gcd % 2 == 0:
		flg = False
		break
if flg:
	min_x = int(lcm(A)) // 2
	ans = m // min_x - m // (2 * min_x)
	print(ans)
else:
	print(0)


from math import gcd
(N, M) = map(int, input().split())
A = [int(i) for i in input().split()]
flag = False
res = 1
for a in A:
	a //= 2
	res *= a // gcd(res, a)
	if res > M:
		flag = True
		break
for a in A:
	if int(res / a) == res / a:
		flag = True
if flag:
	ans = 0
	print(ans)
else:
	ans = (M // res + 1) // 2
	print(ans)


import math

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

def co(num):
	return format(num, 'b')[::-1].find('1')
(N, M) = map(int, input().split())
L = list(map(int, input().split()))
L2 = [co(i) for i in L]
if len(set(L2)) != 1:
	print(0)
	return
L = [i // 2 for i in L]
s = L[0]
for i in range(N):
	s = lcm(s, L[i])
c = M // s
print((c + 1) // 2)


from math import gcd
from functools import reduce
(n, m) = map(int, input().split())
lst = list(map(lambda x: int(x) // 2, input().split()))
divi = 0
x = lst[0]
while x % 2 == 0:
	x //= 2
	divi += 1
for i in range(1, n):
	divi2 = 0
	x = lst[i]
	while x % 2 == 0:
		x //= 2
		divi2 += 1
	if divi != divi2:
		print(0)
		exit()
work = reduce(lambda x, y: x * y // gcd(x, y), lst)
print((m // work + 1) // 2)


from math import gcd
import sys
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
lcm = 1
for a in A:
	gcd_ = gcd(lcm, a // 2)
	lcm = lcm * (a // 2 // gcd_)
for a in A:
	if lcm // (a // 2) % 2 == 0:
		print(0)
		sys.exit()
print(M // lcm - M // (2 * lcm))


from math import gcd
(N, M) = map(int, input().split())
A = [a // 2 for a in map(int, input().split())]
lcm = 1
for a in A:
	lcm = lcm * a // gcd(lcm, a)
	if lcm > M:
		print(0)
		exit()
for a in A:
	div = lcm // a
	if div % 2 == 0:
		print(0)
		exit()
ans = (M // lcm + 1) // 2
print(ans)


from functools import reduce

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

def lcm(a, b):
	return a // gcd(a, b) * b
(N, M) = map(int, input().split())
As = list(map(int, input().split()))
Bs = [A // 2 for A in As]
lcmB = reduce(lcm, Bs)
for B in Bs:
	if lcmB // B % 2 == 0:
		print(0)
		break
else:
	num = M // lcmB
	print((num + 1) // 2)


import math

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

def div2(n):
	return bin(n)[::-1].find('1')
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
ans = a[0]
count = div2(a[0])
for i in range(1, len(a)):
	if count != div2(a[i]):
		print(0)
		exit()
	ans = lcm(ans, a[i])
ans //= 2
print((m // ans + 1) // 2)


import math
(N, M) = map(int, input().split())
B = tuple((int(a) // 2 for a in input().split()))
x = B[0]
for i in range(1, N):
	x = x * B[i] // math.gcd(x, B[i])
for b in B:
	if x // b % 2 == 0:
		print(0)
		break
else:
	ans = M // x - M // (2 * x)
	print(ans)


from functools import reduce
(N, M) = list(map(int, input().split()))
As = list(map(int, input().split()))
Bs = [A // 2 for A in As]

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

def lcm(a, b):
	return a // gcd(a, b) * b
nums = []
for B in Bs:
	num = 0
	while B % 2 == 0:
		B //= 2
		num += 1
	nums.append(num)
if len(set(nums)) != 1:
	ans = 0
else:
	L = reduce(lcm, Bs)
	ans = M // L - M // (2 * L)
print(ans)


from math import gcd
from functools import reduce
(n, m) = map(int, input().split())
a = list(map(int, input().split()))

def lcm(a, b):
	return a * b // gcd(a, b)
a = [i // 2 for i in a]
l = reduce(lcm, a)
if any((l // i % 2 == 0 for i in a)):
	print(0)
	return
print(-(-(m // l) // 2))


from functools import reduce
import math

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

def lcm_list(numbers):
	return reduce(lcm, numbers, 1)
(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [a // 2 for a in A]
count_div_2 = None
for a in A:
	cnt = 0
	while a % 2 == 0:
		a //= 2
		cnt += 1
	if count_div_2 is None:
		count_div_2 = cnt
	elif cnt != count_div_2:
		print(0)
		return
my_lcm = lcm_list(A)
if my_lcm > M:
	print(0)
	return
tmp = M // my_lcm
ans = (tmp + 1) // 2
print(ans)


import sys
(N, M) = list(map(int, input().split()))
A = list(map(int, input().split()))
a = []
for i in A:
	i = i // 2
	a.append(i)

def gcd(p, q):
	(p, q) = (max(p, q), min(p, q))
	while q != 0:
		(p, q) = (q, p % q)
	return p

def lcm(p, q):
	return p * q // gcd(p, q)

def aaa(i):
	count = 0
	while i % 2 == 0:
		i = i // 2
		count += 1
	return count
max_num = a[0]
aa = aaa(a[0])
for i in a:
	max_num = lcm(i, max_num)
	if aa != aaa(i):
		print(0)
		return
print((M // max_num + 1) // 2)


import sys
(N, M) = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a // gcd(a, b) * b
tx = 1
for a in A:
	tx = lcm(tx, a)
B = []
for a in A:
	B.append(tx // a)
for b in B:
	if b % 2 == 0:
		print(0)
		sys.exit()
ans = (M // (tx // 2) + 1) // 2
print(ans)


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

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while a % b > 0:
		(a, b) = (b, a % b)
	return b

def lcd(a, b):
	return a * b // gcd(a, b)
L = 1
cur = -1
for i in range(len(A)):
	A[i] //= 2
	p = A[i]
	c = 0
	while p % 2 == 0:
		p //= 2
		c += 1
	if cur != -1:
		if c != cur:
			print(0)
			exit(0)
	cur = c
	L = lcd(L, A[i])
ans = M // (L * 2)
ans += M % (L * 2) // L
print(ans)


def gcd(a, b):
	if a < b:
		return gcd(b, a)
	while b > 0:
		(a, b) = (b, a % b)
	return a
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
x = 1
for i in range(n):
	b = a[i] // 2
	x = x * b // gcd(x, b)
if any((2 * x // y % 2 == 0 for y in a)):
	print(0)
	quit()
print((m - x) // (2 * x) + 1)


from math import gcd

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

def lcm_g(A):
	ret = 1
	for a in A:
		ret = lcm(ret, a)
	return ret

def is_hcm(x, A):
	for i in range(N):
		if x % A[i] != A[i] // 2:
			return False
	return True
(N, M) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
l = lcm_g(A)
if is_hcm(l // 2, A):
	ans = (2 * M + l) // (2 * l)
else:
	ans = 0
print(ans)


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

def solve(N, M, As):
	if sum([a % 2 for a in As]) > 0:
		print(0)
		return
	As = [a // 2 for a in As]
	all_lcm = 1
	for a in As:
		all_lcm = lcm(all_lcm, a)
		if all_lcm > M:
			print(0)
			return
	for a in As:
		if all_lcm // a % 2 == 0:
			print(0)
			return
	from math import ceil
	print(ceil(M // all_lcm / 2))

def __starting_point():
	(N, M) = list(map(int, input().split()))
	As = [int(i) for i in input().split()]
	solve(N, M, As)
__starting_point()


import math
import collections
import sys
input = sys.stdin.readline

def I():
	return int(input())

def MI():
	return list(map(int, input().split()))

def LI():
	return list(map(int, input().split()))

def LI2():
	return [int(input()) for i in range(n)]

def MXI():
	return [[LI()] for i in range(n)]
(n, m) = MI()
A = LI()

def num2(x):
	ans = 0
	while x % 2 == 0:
		x = x // 2
		ans += 1
	return ans
mod = 2 ** num2(A[0])
for i in range(1, n):
	if A[i] % mod != 0:
		print(0)
		return
	if A[i] % mod == 0 and A[i] // mod % 2 == 0:
		print(0)
		return
for i in range(n):
	A[i] //= 2

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

def lcm(a, b):
	return a // gcd(a, b) * b
L = A[0]
for i in range(1, n):
	L = lcm(L, A[i])
if L > m:
	an = 0
else:
	an = int((m / L - 1) / 2) + 1
print(an)


import sys
input = sys.stdin.readline
from math import gcd, ceil

def main():
	(N, M) = list(map(int, input().split()))
	A = list([int(x) // 2 for x in input().split()])
	lcm = A[0]
	for i in range(1, N):
		lcm = lcm * A[i] // gcd(lcm, A[i])
	allo = 1
	for i in range(N):
		allo &= lcm // A[i] % 2
	if allo:
		print(ceil(int(M // lcm) / 2))
	else:
		print(0)

def __starting_point():
	main()
__starting_point()


import math
from functools import reduce

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

def lcm(*numbers):
	return reduce(lcm_base, numbers, 1)
(N, M) = map(int, input().split())
a = list(map(lambda a: int(a) // 2, input().split()))
g = lcm(*a)
if any([g // item % 2 == 0 for item in a]):
	print(0)
else:
	ans = M // g
	ans = max(math.ceil(ans / 2), 0)
	print(ans)


(N, M) = map(int, input().split())
A = list(map(lambda x: int(x) // 2, input().split()))
import math

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

def pow2(x):
	ret = 0
	while x % 2 == 0:
		ret += 1
		x //= 2
	return ret
P = []
for a in A:
	P.append(pow2(a))
if len(set(P)) != 1:
	print(0)
else:
	m = 1
	for a in A:
		m = lcm(m, a)
	print(-(-(M // m) // 2))


import math
(n, m) = map(int, input().split())
al = list(map(int, input().split()))
twos = set()
for c in al:
	(temp, tempc) = (0, c)
	while tempc % 2 == 0:
		tempc //= 2
		temp += 1
	twos.add(temp)
if len(twos) > 1:
	print(0)
else:
	lcmv = al[0]
	for i in range(1, n):
		lcmv = lcmv * al[i] // math.gcd(lcmv, al[i])
	print(max(0, 1 + (m - lcmv // 2) // lcmv))


import math
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
pow2 = 0
while A[0] % 2 == 0:
	A[0] //= 2
	pow2 += 1
for i in range(1, N):
	cnt = 0
	while A[i] % 2 == 0:
		A[i] //= 2
		cnt += 1
	if cnt != pow2:
		print(0)
		return
LCM = 2 ** max(0, pow2 - 1)
for i in range(N):
	LCM = LCM * A[i] // math.gcd(LCM, A[i])
ans = M // LCM
print((ans + 1) // 2)


import sys

def gcd(x, y):
	if x % y == 0:
		return y
	return gcd(y, x % y)
(n, m) = map(int, input().split())
a = list(map(int, input().split()))
cur = a[0]
for x in a[1:]:
	g = gcd(cur, x)
	if cur // 2 % g != x // 2 % g:
		print(0)
		sys.exit(0)
	else:
		cur = cur // g * x
	if cur > m * 2:
		print(0)
		sys.exit(0)
print((m + cur // 2) // cur)


import math

def lcm(x, y):
	return x * y // math.gcd(x, y)
(n, m) = map(int, input().split())
l = list(map(int, input().split()))
a = l[0] // 2
for i in range(n - 1):
	a = lcm(a, l[i + 1] // 2)
ok = True
for i in range(n):
	if a // (l[i] // 2) % 2 != 1:
		ok = False
		break
ans = 0
if ok:
	ans = (m // a + 1) // 2
print(ans)


from math import gcd
import sys

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

def count(x):
	res = 0
	while True:
		if x % 2 == 0:
			res += 1
			x //= 2
		else:
			break
	return res
(n, m) = list(map(int, input().split()))
A = list(map(int, input().split()))
A = list(set(A))
n = len(A)
A.sort(reverse=True)
temp = A[0]
for i in range(1, n):
	if count(A[i]) != count(temp):
		print(0)
		return
	else:
		temp = lcm(temp, A[i])
ans = m // (temp // 2) - m // temp
print(ans)


(n, m) = map(int, input().split())
A = [int(i) // 2 for i in input().split()]

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

def div2(x):
	ret = 0
	while x % 2 == 0:
		ret += 1
		x //= 2
	return ret
s = div2(A[0])
chk = True
mul = A[0]
for i in range(1, n):
	if s != div2(A[i]) or mul > m:
		chk = False
	else:
		mul = mul * A[i] // gcd(mul, A[i])
if not chk:
	print(0)
else:
	print(m // mul - m // (mul * 2))


import math
(n, m) = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
	a1 = a[0] // 2
	ans_m = m // a1
	if ans_m == 0:
		print(0)
	else:
		print((ans_m - 1) // 2 + 1)
else:
	x = a[0]
	ch = 0
	ch1 = 0
	while x % 2 == 0:
		x = x // 2
		ch += 1
	dob = 2 ** ch
	for i in a:
		if i % dob == 0 and i % (dob * 2) != 0:
			ch1 += 1
	if ch1 != n:
		print(0)
	else:
		ans = a[0] // 2
		for j in range(1, n):
			ans = ans * (a[j] // 2) // math.gcd(ans, a[j] // 2)
		ans_m = m // ans
		if ans_m == 0:
			print(0)
		else:
			print((ans_m - 1) // 2 + 1)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
(N, M) = map(int, input().split())
A = list(map(int, input().split()))
LCM = 1
for i in A:
	i = i // 2
	LCM = lcm(i, LCM)
for i in A:
	i = i // 2
	if LCM // i % 2 == 0:
		print(0)
		exit()
ans = (M // LCM + 1) // 2
print(ans)


from functools import reduce

def main():
	(N, M) = map(int, input().split())
	(*A,) = map(int, input().split())
	A = list(set(A))
	N = len(A)
	B = [A[i] // 2 for i in range(N)]

	def factorize(n):
		out = []
		i = 2
		while i == 2:
			if n % i == 0:
				out.append(i)
				n //= i
			else:
				i += 1
			if n == 1:
				break
			if i > int(n ** 0.5 + 3):
				out.append(n)
				break
		return out
	ord_list = [len(factorize(B[i])) for i in range(N)]
	if len(set(ord_list)) != 1:
		print(0)
		return

	def gcd(a, b):
		if b == 0:
			return a
		return gcd(b, a % b)

	def lcm(a, b):
		return a * b // gcd(a, b)
	LCM = reduce(lcm, B)
	print((M // LCM + 1) // 2)

def __starting_point():
	main()
__starting_point()


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

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def cnt(a):
	res = 0
	while a and a % 2 == 0:
		a //= 2
		res += 1
	return res
(n, m) = map(int, input().split())
A = list(map(int, input().split()))
l = 1
c = cnt(A[0])
for a in A:
	if cnt(a) != c or c == 0:
		print(0)
		return
	else:
		l = lcm(l, a // 2)
d = m // l
print((d + 1) // 2)


import numpy as np
import sys

def main():
	(N, M) = list(map(int, input().split()))
	A = list(map(int, input().split()))
	A_double = list([x // 2 for x in A])
	mini_multi = int(np.lcm.reduce(A_double))
	res = M // mini_multi
	for i in A_double:
		if mini_multi // i % 2 == 0:
			print(0)
			return
	if res % 2 != 0:
		res += 1
	print(res // 2)

def __starting_point():
	main()
__starting_point()


import copy

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

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

def main():
	(n, m) = map(int, input().split())
	A = set([int(x) for x in input().split()])
	a_lcm = 1
	for a in A:
		a_lcm = lcm(a_lcm, a)
		if a_lcm / 2 > m:
			print(0)
			return
	for a in A:
		if a_lcm / 2 % a == 0:
			print(0)
			return
	ans = int((m - a_lcm / 2) // a_lcm) + 1
	print(ans)

def __starting_point():
	main()
__starting_point()