Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
flg = True
import numpy as np
num = np.array(A)
while flg:
  if all([a>0 for a in num]):
    flg = all([0==a%2 for a in num])
    num = num//2
  else:
    break
A = np.array(A)//2
A = A.tolist()
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 gcd_many(l):
  if len(l) == 2:
    return gcd(l[0],l[1])
  else:
    return gcd_many(l[2:]+[gcd(l[0],l[1])])

def lcm_many(l):
  if len(l) == 1:
    return l[0]
  elif len(l) == 2:
    return lcm(l[0],l[1])
  elif l[0] > m:
    return 0
  else:
    return lcm_many([lcm(l[0],l[1])] + l[2:])
if flg:
  print(0)
else:
  lc = lcm_many(A)
  ans = (m // lc) // 2 if lc < m else 0
  if lc % 2 != 0:
    ans += 1
  print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
from fractions import gcd
from functools import reduce
 
N,M,*A = map(int,read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 
def merge(a,b):
    g = gcd(a,b)
    a //= g; b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n
 
x = reduce(merge, A)
if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
flg = True
import numpy as np
num = np.array(A)
while flg:
  if all([a>0 for a in num]):
    flg = all([0==a%2 for a in num])
    num = num//2
  else:
    break
A = np.array(A)//2
A = A.tolist()
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 gcd_many(l):
  if len(l) == 2:
    return gcd(l[0],l[1])
  else:
    return gcd_many(l[2:]+[gcd(l[0],l[1])])

def lcm_many(l):
  if len(l) == 2:
    return lcm(l[0],l[1])
  else:
    return lcm_many([lcm(l[0],l[1])] + l[2:])
if flg:
  print(0)
else:
  lc = lcm_many(A)
  ans = (m // lc) // 2 if lc < m else 0
  if lc % 2 != 0:
    ans += 1
  print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
from fractions import gcd
from functools import reduce
 
N,M,*A = map(int,read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 
def merge(a,b):
    g = gcd(a,b)
    a //= g; b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n
 
x = reduce(merge, A)
if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
import numpy as np
A = np.array(A)//2
A = A.tolist()
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 gcd_many(l):
  if len(l) == 2:
    return gcd(l[0],l[1])
  else:
    return gcd_many(l[2:]+[gcd(l[0],l[1])])

def lcm_many(l):
  if len(l) == 2:
    return lcm(l[0],l[1])
  else:
    return lcm_many([lcm(l[0],l[1])] + l[2:])
lc = lcm_many(A)
ans = (m // lc) // 2 if lc < m else 0
if lc % 2 != 0:
  ans += 1
print(ans)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
from fractions import gcd
from functools import reduce
 
N,M,*A = map(int,read().split())
 
# 「奇数倍」に帰着
A = [x >> 1 for x in A]
 
def merge(a,b):
    g = gcd(a,b)
    a //= g; b //= g
    if a % 2 == 0:
        return 0
    if b % 2 == 0:
        return 0
    n = a * b * g
    if n > 10 ** 9:
        return 0
    return n
 
x = reduce(merge, A)
if x == 0:
    answer = 0
else:
    answer = (M//x) - (M//(x+x))
 
print(answer)