import fractions

def lcm(x, y):

    return (x * y) // fractions.gcd(x, y)

N,M = [int(x) for x in input().split()]

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

a = 1

MOD = 10**9+7

cnt = 0

l = 0

for i in A:

  i = i//2

  a = lcm(a,i)

for i in A:

  cnt1=0

  i=i//2

  b=a//i

  if b%2==0:

    while b%2==0:

      b=b/2

      cnt1+=1

  if cnt==0:

    cnt=cnt1

    l+=1

  else:

    if cnt!=cnt1:

      print((0))

      exit()

if l==N and cnt!=0:

  print((0))

  exit()

print(((M//a+2-1)//2))
import fractions

def lcm(x, y):

    return (x * y) // fractions.gcd(x, y)

N,M = [int(x) for x in input().split()]

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

a = 1

MOD = 10**9+7

cnt = 10**9

l = 0

for i in A:

  i = i//2

  a = lcm(a,i)

for i in A:

  cnt1=0

  b=i//2

  if b%2==0:

    while b%2==0:

      b=b/2

      cnt1+=1

  if cnt==10**9:

    cnt=cnt1

  elif cnt!=cnt1:

    print((0))

    exit()

print(((M//a+2-1)//2))

import fractions


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


N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9 + 7
cnt = 0
l = 0
for i in A:
    i = i // 2
    a = lcm(a, i)
for i in A:
    cnt1 = 0
    i = i // 2
    b = a // i
    if b % 2 == 0:
        while b % 2 == 0:
            b = b / 2
            cnt1 += 1
    if cnt == 0:
        cnt = cnt1
        l += 1
    else:
        if cnt != cnt1:
            print((0))
            exit()
if l == N and cnt != 0:
    print((0))
    exit()
print(((M // a + 2 - 1) // 2))

import fractions


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


N, M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
a = 1
MOD = 10**9 + 7
cnt = 10**9
l = 0
for i in A:
    i = i // 2
    a = lcm(a, i)
for i in A:
    cnt1 = 0
    b = i // 2
    if b % 2 == 0:
        while b % 2 == 0:
            b = b / 2
            cnt1 += 1
    if cnt == 10**9:
        cnt = cnt1
    elif cnt != cnt1:
        print((0))
        exit()
print(((M // a + 2 - 1) // 2))

-cnt = 0 +cnt = 10**9 -    i = i // 2 -    b = a // i +    b = i // 2 -    if cnt == 0: +    if cnt == 10**9: -        l += 1 -    else: -        if cnt != cnt1: -            print((0)) -            exit() -if l == N and cnt != 0: -    print((0)) -    exit() +    elif cnt != cnt1: +        print((0)) +        exit()