Buggy python submission (verdict: Runtime Error):
import fractions

def lcm(num_list):
    if len(num_list) > 2:
        lcm_tmp = lcm(num_list[:2])
        if M * 2 < lcm_tmp:
            return None
        num_list_new = [lcm_tmp]
        num_list_new.extend(num_list[2:])
        return lcm(num_list_new)
    elif len(num_list) == 2:
        return num_list[0] * num_list[1] // fractions.gcd(num_list[0], num_list[1])

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

lcm_of_a = lcm(a)
if lcm_of_a is None:
    print(0)
count = M * 2 // lcm_of_a
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)


Fixed submission:
from fractions import gcd
from functools import reduce
import sys

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

n, m = map(int, input().split())
a = [int(item) // 2 for item in input().split()]
b = [0] * n

for i in range(n):
    tmp = a[i]
    while True:
        if tmp % 2 == 0:
            b[i] += 1
            tmp /= 2
        else:
            break

if len(set(b)) != 1:
    print(0)
    sys.exit()

a_lcm = lcm(a)
count = m // a_lcm
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)

Buggy python submission (verdict: Runtime Error):
import fractions

def lcm(num_list):
    if len(num_list) > 2:
        num_list_new = [lcm(num_list[:2])]
        num_list_new.extend(num_list[2:])
        return lcm(num_list_new)
    elif len(num_list) == 2:
        return num_list[0] * num_list[1] // fractions.gcd(num_list[0], num_list[1])

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

lcm_of_a = lcm(a)
count = M * 2 // lcm_of_a
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)


Fixed submission:
from fractions import gcd
from functools import reduce
import sys

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

n, m = map(int, input().split())
a = [int(item) // 2 for item in input().split()]
b = [0] * n

for i in range(n):
    tmp = a[i]
    while True:
        if tmp % 2 == 0:
            b[i] += 1
            tmp /= 2
        else:
            break

if len(set(b)) != 1:
    print(0)
    sys.exit()

a_lcm = lcm(a)
count = m // a_lcm
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)

Buggy python submission (verdict: Runtime Error):
import math

def gcd(num_list):
    if len(num_list) > 2:
        num_list_new = [math.gcd(*num_list[:2])]
        num_list_new.extend(num_list[2:])
        return gcd(num_list_new)
    elif len(num_list) == 2:
        return math.gcd(*num_list)

def lcm(num_list):
    if len(num_list) > 2:
        num_list_new = [lcm(num_list[:2])]
        num_list_new.extend(num_list[2:])
        return lcm(num_list_new)
    elif len(num_list) == 2:
        return num_list[0] * num_list[1] // math.gcd(num_list[0], num_list[1])

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

lcm_of_a = lcm(a)
count = M * 2 // lcm_of_a
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)
    

Fixed submission:
from fractions import gcd
from functools import reduce
import sys

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

n, m = map(int, input().split())
a = [int(item) // 2 for item in input().split()]
b = [0] * n

for i in range(n):
    tmp = a[i]
    while True:
        if tmp % 2 == 0:
            b[i] += 1
            tmp /= 2
        else:
            break

if len(set(b)) != 1:
    print(0)
    sys.exit()

a_lcm = lcm(a)
count = m // a_lcm
if count % 2 == 0:
    print(count // 2)
else:
    print((count + 1) // 2)