import sys

import itertools

# import numpy as np

import time

import math

 

sys.setrecursionlimit(10 ** 7)

 

from collections import defaultdict

 

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

 

 

from functools import reduce

# from math import *

from fractions import *

N, M = list(map(int, readline().split()))

A = list(sorted([int(x) // 2 for x in readline().split()]))

min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)

 

# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))

if not all([(min_cm // x) % 2 == 1 for x in A]):

    print((0))

    exit(0)

if min_cm > M:

    print((0))

    exit(0)

ans = (M // min_cm + 1) // 2

print(ans)
import sys

import itertools

# import numpy as np

import time

import math

import heapq

from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

 

INF = 10 ** 9 + 7

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



# map(int, input().split())



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

A = list([int(x) // 2 for x in input().split()])



def f(n):

    res = 0

    while n % 2 == 0:

        n //= 2

        res += 1

    return res



def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)



x = f(A[0])

for a in A:

    y = f(a)

    if y != x:

        print((0))

        exit()



lcm = A[0]

for i in range(1, N):

    lcm = lcm * A[i] //  gcd(lcm, A[i])



print(((M // lcm + 1) // 2))
import sys
import itertools

# import numpy as np
import time
import math

sys.setrecursionlimit(10**7)
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import reduce

# from math import *
from fractions import *

N, M = list(map(int, readline().split()))
A = list(sorted([int(x) // 2 for x in readline().split()]))
min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)
# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))
if not all([(min_cm // x) % 2 == 1 for x in A]):
    print((0))
    exit(0)
if min_cm > M:
    print((0))
    exit(0)
ans = (M // min_cm + 1) // 2
print(ans)

import sys
import itertools

# import numpy as np
import time
import math
import heapq
from collections import defaultdict

sys.setrecursionlimit(10**7)
INF = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
N, M = list(map(int, input().split()))
A = list([int(x) // 2 for x in input().split()])


def f(n):
    res = 0
    while n % 2 == 0:
        n //= 2
        res += 1
    return res


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


x = f(A[0])
for a in A:
    y = f(a)
    if y != x:
        print((0))
        exit()
lcm = A[0]
for i in range(1, N):
    lcm = lcm * A[i] // gcd(lcm, A[i])
print(((M // lcm + 1) // 2))

+import heapq +from collections import defaultdict -from collections import defaultdict - +INF = 10**9 + 7 -from functools import reduce +# map(int, input().split()) +N, M = list(map(int, input().split())) +A = list([int(x) // 2 for x in input().split()]) -# from math import * -from fractions import * -N, M = list(map(int, readline().split())) -A = list(sorted([int(x) // 2 for x in readline().split()])) -min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A) -# print(all(map(lambda x: (min_cm // x) % 2 == 1, A))) -if not all([(min_cm // x) % 2 == 1 for x in A]): -    print((0)) -    exit(0) -if min_cm > M: -    print((0)) -    exit(0) -ans = (M // min_cm + 1) // 2 -print(ans) +def f(n): +    res = 0 +    while n % 2 == 0: +        n //= 2 +        res += 1 +    return res + + +def gcd(a, b): +    if b == 0: +        return a +    return gcd(b, a % b) + + +x = f(A[0]) +for a in A: +    y = f(a) +    if y != x: +        print((0)) +        exit() +lcm = A[0] +for i in range(1, N): +    lcm = lcm * A[i] // gcd(lcm, A[i]) +print(((M // lcm + 1) // 2))