Buggy python submission (verdict: Time Limit Exceeded):
import fractions
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d* l[i]// fractions.gcd(d,l[i])
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)

Fixed submission:
import fractions
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d*l[i]// fractions.gcd(d,l[i])
        if m < d:
            break
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)

Buggy python submission (verdict: Time Limit Exceeded):
import fractions
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d* l[i]// fractions.gcd(d,l[i])
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)

Fixed submission:
import fractions
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d*l[i]// fractions.gcd(d,l[i])
        if m < d:
            break
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)

Buggy python submission (verdict: Runtime Error):
import math
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d* l[i]// math.gcd(d,l[i])
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)

Fixed submission:
import fractions
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = 1
c = 0
key = 1
key1 = 1
l = []
while key == 1:
    if a[0] % b == 0:
        b *= 2
        c += 1
    else:
        b //= 2
        c -= 0
        key = 0
for i in range(n):
    if a[i] % b == 0:
        if (a[i]//b) % 2 == 0:
            key1 = 0
            break
        else:
            l.append(a[i]//b)
    else:
        key1 = 0
        break
if key1 == 0 or c == 0:
    print(0)
else:
    d = l[0]
    for i in range(1,n):
        d = d*l[i]// fractions.gcd(d,l[i])
        if m < d:
            break
    d = d*b//2
    if (m//d)%2 == 0:
        print((m//d)//2)
    else:
        print((m//d)//2+1)