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: interview

Starter code:

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

def f( a_k ): # 2で割り切れる回数
    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( b_lcm, f_0, b )
print( ( m + a_lcm // 2 ) // a_lcm )

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)


import math

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = {}
for i in range(n):
    count = 0
    temp = a[i]
    while temp % 2 == 0:
        count += 1
        temp //= 2
    b.setdefault(count, 0)
    b[count] += 1
if len(b.keys()) >= 2:
    ans = 0
else:
    temp = 1
    for i in range(n):
        temp = temp * a[i] // math.gcd(temp, a[i])
    temp2 = temp // 2
    ans = m // temp2 - m // temp
print(ans)

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()

# ABC150D

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 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
def lcm(a,b):return (a*b)//(gcd(a,b))

def f(x):
    cnt=0
    while(x%2==0):
        cnt+=1
        x=x//2
    return cnt

n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x: x//2,a))

t=f(a[0])
for i in range(n):
    if(f(a[i])!=t):
        print(0)
        return
    a[i]=a[i]//(2**t)
m=m//(2**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)

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))
    
      


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 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()

# -*- coding: utf-8 -*-
"""
Created on Wed Sep  9 14:33:00 2020

@author: liang
"""
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
    #print(res)
"""
存在チェック
２で割り切れる個数同じ？
"""

for a in A:
    if int(res/a) == res/a:
        flag = True
        
if flag:
    ans = 0
    print(ans)
else:
    #ans = (M - res(A)//2)//res + 1
    #ans = (M-1)//res//2 + 1
    ans= (M//res + 1)//2
    print(ans)

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)

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()

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))

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

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

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

count2 = [0 for i in range(N)]
for i in range(N):
  a = A[i]
  while a%2==0:
    count2[i] += 1
    a = a//2
  A[i] = a
if sum(count2) == count2[0]*N:
  count2 = count2[0]
  buf = 1
  for i in range(N):
    buf = A[i]*buf//GCM(buf, A[i])
  buf *= 2**(count2-1)
  #print(buf)
  n = M//buf
  print((n+1)//2)
  
else:
  print(0)

import fractions
import math
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)

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

n,m=map(int,input().split())
a=list(map(int,input().split()))
b=lcm_list(map(lambda x: x//2, a))
swt=0

for i in range(n):
  if 0==(b//(a[i]//2))%2:
    swt=1
    break

if 0==swt:
  print(math.ceil((m//b)/2))
else:
  print(0)

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

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
  
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=lcm_base(test, k)
if l==0:
  k=test*c//2
  print(M//k//2 + M//k%2)

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 copy
# from math import gcd


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)
        # mがlcmの半分よりも小さかったら0
        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()

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)
#2で割り切れる回数が同じでないものがある場合
if any(i%c for i in A):
    print(0);return
x=m//p
#print(p//c)
print(-(-x//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))


from fractions import gcd

def lcm_base(x, y):
    return (x * y) // gcd(x, y)
def lcm(numbers):
    x = numbers[0]
    for y in numbers:
        x = lcm_base(x, y)
    return x

N, M = list(map(int, input().split()))
aaa = list(map(int, input().split()))
a = aaa[0]
cnt = 0
while a % 2 == 0:
    cnt += 1
    a //= 2
for a in aaa:
    if a % 2 ** cnt != 0 or a % 2 ** (cnt + 1) == 0:
        print((0))
        return        
bbb = [a // 2 for a in aaa]
lc = lcm(bbb)
q, r = divmod(M // lc , 2)
print((q + r))


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)

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

a0 = A[0]
cnt = 0
while a0%2 == 0:
    a0 //= 2
    cnt += 1

a = []
for aa in A:
    if cnt == 1:
        if aa%4 == 0:
            print(0)
            return
    else:
        if aa%(2**(cnt-1)) != 0 or aa%(2**cnt) != 0 or aa%(2**(cnt+1)) == 0:
            print(0)
            return
    a.append(aa//2)


def lcm_base(p, q):
    return (p * q) // math.gcd(p, q)


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


lcm = lcm_list(a)
print(m//lcm - m//(lcm*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()

import math
from functools import reduce
n, m = input().split()
a = list(map(int, input().split()))
b =[0]*int(n)
for i in range(len(a)):
  b[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 = 0

x = lcm_list(b)
for i in range(int(n)):
  if (x // b[i]) % 2 == 0:
    c = -1
    break
  else:
    continue
    
if c == -1:
  print((0))
else:
  print((math.floor(((int(m)/x)+1)/2)))



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

from fractions import gcd
def two(n):
    ans = 0
    while n%2==0:
        n //= 2
        ans += 1
    return ans

def multi_lcm(A):
    ans = A[0]
    for a in A:
        ans *= a//gcd(ans,a)
    return ans

def solve(N,M,A):
    ans = 0
    num_two = len(set(map(two,A)))
    if num_two != 1:
        return 0
    l = multi_lcm(A)
    ans = (M+l//2)//l
    return ans
print((solve(N,M,A)))


from math import gcd

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

f = lambda n: 0 if n%2 else f(n>>1)+1
x = f(A[0])

if sum(x!=f(a) for a in A):
    print(0)
    return

A = [a>>x for a in A]

y = 1
for a in A:
    y = y*a//gcd(y, a)
    if y<<(x-1) > M:
        print(0)
        return

print((M//(y<<(x-1))+1)//2)

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 = list(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
 
 
def euclid(a, b):
  while b:
    a, b = b, a%b
  return a

lcm = a.pop()
for k in range(1, N):
  b = a.pop()
  lcm = lcm * b // euclid(lcm, b)
  if lcm* foo > M:
    print((0))
    return
lcm *= foo
ans = int((M / lcm -1)//2 + 1)
print(ans)



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)

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):
    #s=set(a)
    #print(s)
    x=a[0]//2
    for i in range(1,n):
        x=lcm(x,a[i]//2)
    #print(x)
    gusubai=False
    kisubai=False
    for i in range(n):
        if x%a[i]!=0:
            gusubai=True
        else:
            kisubai=True
    
    y=m//x
    #print(y,x,m)
    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()

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N, M = MI()
    L = LI()
    L = [i//2 for i in L]
    
    past = L[0]

    for i in L:
        past = (past // math.gcd(i, past)) * i
        if past > M or (past // i) % 2 == 0:
            print(0)
            return
    
    temp = M // past
    ans = (temp+1)//2
    print(ans)        
    

    

def __starting_point():
    main()
__starting_point()

from fractions import gcd
N, M = list(map(int, input().split()))
A = list(map(lambda x: int(x),input().split()))

cnt = [0 for _ in range(N)]
for i in range(N):
  a = A[i]
  while a%2 == 0:
    a = a // 2
    cnt[i] += 1

if max(cnt) > min(cnt):
  print(0)
  return
C = max(cnt)

A = list(map(lambda x: x // pow(2,C), A))
def gcd(a,b):
  if a<b:
    a,b = b,a
  while a%b > 0:
    a,b = b,a%b
  return b

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

x = A[0]
for a in A[1:]:
  x = lcm(x,a)
x = x * pow(2,C-1)

print((M // x + 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)
        return

work=reduce(lambda x,y: x*y//gcd(x,y),lst)
print((m//work+1)//2)

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, 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))

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)

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)
    return
temp=m//lcma
print(-(-temp//2))

import sys
import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

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
input=sys.stdin.readline
import math

N,M=(int(x) for x in input().rstrip('\n').split())
As=[int(x) for x in input().rstrip('\n').split()]
n = 1
use2 = 0
check = 0
for i in range(N):
  x = As[i]
  if i==0:
    while x % 2==0:
      use2+=1 
      x = x//2
    lcm=x
  else:
    use=0
    while x%2==0:
      x = x//2
      use += 1
    if use2 != use:
      check += 1
      break
    lcm=lcm*x//(math.gcd(lcm,x))
if check > 0:
  print(0)
else:
  LCM=2**(use2-1)
  LCM=LCM*lcm
  print(((M//LCM)+1)//2)

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)

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))

import math
n,m= list(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)))


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**.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()

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)

import math
import fractions
from functools import reduce
 
n, m = map(int, input().split())
a = list(map(int, input().split()))
a=[t//2 for t in a] # リストの要素を全て2で割る
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm_list(numbers): # 最小公倍数を求める
    return reduce(lcm_base, numbers, 1)
 
def num_dev2(x): # 2で割り切れる回数をカウント
    return format(x, 'b')[::-1].find('1')
 
lcm = lcm_list(a)
q = m // lcm # mは最小公倍数で何回割れるか
 
count = 0
dev2 = num_dev2(a[0])
for i in range(1, n):
    if dev2 != num_dev2(a[i]): # リストの全ての要素の、2で割れる回数は等しいか？
        count += 1
        break
if count != 0:
    print(0)
else:
    print(math.ceil(q/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#float('inf')
#mod = 10 ** 9 + 7 
mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N, M = MAP()
a = LIST()

A = sorted([x//2 for x in a], reverse=True)

b = A[0]
cnt = 0
while b%2 == 0:
	b //= 2
	cnt += 1

for x in A:
	if x%pow(2, cnt) or (x//pow(2, cnt))%2 == 0:
		print(0)
		return

lcm = A[-1]
for x in A:
	lcm = lcm*x//gcd(lcm, x)

r = lcm//A[0]
n = M//A[0]

#2p+1が1<=2p+1<=n の範囲で rの倍数となるpの個数
if r%2 == 0:
	print(0)
else:
	print(n//r - n//(2*r))

from math import gcd, ceil
n, m = list(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 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))

from fractions import gcd
def lcm(a,b):
    return (a*b)//gcd(a,b)
n,m = map(int,input().split())
a = list(map(int,input().split()))
ans = 1
for i in a:
    ans = lcm(ans,i)
for i in a:
    if (ans//i) % 2 == 0:
        print(0)
        return
print(((m//(ans//2))+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)

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)))


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

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


G = A[0]/2
for a in A[1:]:
    G *= (a/2)/gcd(G,a//2)
for a in A:
    if G % a == 0:
        print(0)
        return
print(int(M//G - M//G//2))

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

def gcd(num1,num2):
    r=1
    while r>0:
        r=num1%num2
        num1=num2
        num2=r
    return num1

def lcm(num1,num2):
    gcd1=gcd(num1,num2)
    return num1*num2//gcd1

lcm1=a[0]//2
lcm2=a[0]

for i in range(1,n):
    t=a[i]
    lcm1=lcm(lcm1,t//2)
    lcm2=lcm(lcm2,t)
    ta=max(t//2,lcm1)
    tb=min(t//2,lcm1)
    if ta!=tb and ta//tb%2==0:
        lcm1=0
        lcm2=0
        break

if lcm1!=0:
    ans1=m//lcm1
    ans2=m//lcm2
    ans=ans1-ans2
else:
    ans=0

print(ans)


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#float('inf')
#mod = 10 ** 9 + 7 
mod = 998244353
#from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

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
#2p+1が1<=2p+1<=n の範囲で rの倍数となるpの個数
if r%2 == 0:
	print(0)
else:
	print(n//r - n//(2*r))

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)

from math import gcd
N, M = list(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))
        return

for a in A:
    div = lcm//a
    if div % 2 == 0:
        print((0))
        return

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))


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)

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 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)

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 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)

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)
  return
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)

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()

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)
    return
temp=m//lcma
print(temp//2 if temp%2==0 else temp//2+1)

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))

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
def lcm(a, b):
    """最小公倍数"""
    from math import gcd
    return (a * b) // gcd(a, b)


# from decorator import stop_watch
#
#
# @stop_watch
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()]

    # import random
    # N, M = 10 ** 5, 10 ** 9
    # As = [random.randint(5, 5) * 2 for _ in range(N)]
    solve(N, M, As)

__starting_point()

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)))





N, M = list(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]:
  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

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)))


def main():
    N, M = map(int, input().split())
    A = tuple(map(int,input().split()))
    ans = count(A, N, M)
    print(ans)
def count(A, N, M):
    t = hMt(A[0])
    B = [A[0]//(2**t)]
    for val in A[1:]:
        if hMt(val) != t:
            ans = 0
            return ans
        B.append(val//(2**t))
    T = nlcm(B)
    MdivT = (M//(2**(t-1)))//T
    ans = countodd(MdivT)
    return ans
def countodd(num):
    if num%2 == 0:
        ans = num//2
    else:
        ans = num//2 + num%2
    return ans
def nlcm(A):
    LCM = A[0]
    for val in A[1:]:
        #print("%d %d gcm:%d LCM:%d"%(LCM,val,gcm(LCM,val),lcm(LCM,val)))
        LCM = lcm(LCM,val)
    return LCM
    
def gcm(a, b):
    abtuple = (a,b)
    abmin = min([0,1], key=lambda x:abtuple[x])
    remainder = abtuple[1-abmin]%abtuple[abmin]
    if remainder == 0:
        return abtuple[abmin]
    return gcm(abtuple[abmin], remainder)
def lcm(a,b):
    prod = a*b
    ans = prod//gcm(a,b)
    return ans
def hMt(num):
    ans = 0
    tmp = num
    while tmp%2 == 0:
        tmp = tmp//2
        ans += 1
    return ans
main()

N, M = list(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]:
  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
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)
#2で割り切れる回数が同じでないものがある場合
#違うじゃん
if any(i%c for i in A):
    print(0);return
x=m//p
#print(p//c)
if x%2==0:
    print(x//2)
else:
    print(x//2+1)

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()))  #;print(a)

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))


from math import gcd, ceil
n, m = list(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))
print(((m//l+1)//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 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)


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))

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)

# 参考 : https://at274.hatenablog.com/entry/2020/01/15/060000
from functools import reduce
import math


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


def lcm_list(numbers):  # リストを投げると全要素のlcmが返ってくる
    return reduce(lcm, numbers, 1)


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

# 最初、Aの要素は全て偶数。2で割ったものに置き換え
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
    # 1個目は無条件で保存
    if count_div_2 is None:
        count_div_2 = cnt
    # 2個目からチェック
    elif cnt != count_div_2:
        print((0))
        return

# my_lcm = Aの全要素の最小公倍数。　この奇数倍が題意を満たす。
# my_lcmがMを超えていたら1つも作れない
my_lcm = lcm_list(A)
if my_lcm > M:
    print((0))
    return

tmp = M // my_lcm
# my_lcmの1,2,...M倍まで使えるが、偶数は使えない
# tmp=1or2なら1個, 3or4なら2個, 5or6なら3個,...
ans = (tmp + 1) // 2
print(ans)


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
#print(A)
for i in range(n):
    A[i]//=2
#print(A)

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])
#print(L)
if L>m:
    an=0
else:
    an=int(((m/L)-1)/2)+1
print(an)


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)

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
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)

from math import gcd, ceil


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


n, m = list(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 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
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
#a = list(map(lambda x: x // 2, na))
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
#print(nibai, maxi, mini)
if not zero:
  t = Decimal(str((m * 2 // mini) / 2))
  #print(t)
  print(t.quantize(Decimal('0'), rounding=ROUND_HALF_UP))
else:
  print(0)

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)


import math
import fractions
from functools import reduce

n, m = map(int,input().split())
a = list(map(int,input().split()))
a = [t // 2 for t in a]#リストの要素すべてを2で割る

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

def lcm_list(numbers): #最小公倍数を求める
    return reduce(lcm_base, numbers, 1)

def num_dev2(x):
    return bin(x)[::-1].find("1") #２で割り切れる回数を確認

lcm = lcm_list(a)
q = m//lcm #mは最小公倍数で何回割れるか

count = 0
dev2 = num_dev2(a[0])
for i in range(1,n):
    if dev2 != num_dev2(a[i]):#リストのすべての要素の２で割れる回数は等しいか
        count += 1
        break
if count != 0:
    print(0)
else:
    print(math.ceil(q/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)

import sys
import numpy as np
def input(): return sys.stdin.readline().rstrip()

def kosuu(x):
    re = [0,0]
    while x % 2 == 0:
        x = x//2
        re[1]+=1
    re[0]=x
    return re

        
 
def main():
    n,m=map(int, input().split())
    a=list(map(int, input().split()))
    li = [kosuu(a[0])[0]]
    hantei = kosuu(a[0])[1]
    for i in a[1:]:
        hantei2 = kosuu(i)
        if hantei2[1] != hantei:
            print(0)
            break
        else:
            li.append(hantei2[0])
    else:
        lc = np.lcm.reduce(li)
        print(((m//(lc*2**(hantei-1)))+1)//2)
            


def __starting_point():
    main()
__starting_point()

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
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([int(x)//2 for x in 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()