#!/usr/bin/env python3

import sys

from fractions import gcd

import math



def main():

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

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

    tmp = 1

    count = None

    for i in range(N):

      tmp = (tmp * a[i]//2) // gcd(tmp,a[i]//2)

      c = 0

      n = a[i]//2

      while n % 2 == 0:

        c += 1

        n //= 2

      if i == 0:

        count = c

      elif count != c:

        print((0))

        exit()

    print(((M//tmp +1)//2))



if __name__ == '__main__':

    main()

from math import gcd



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

A = list(map(int, input().split()))

B = [a//2 for a in A]

LCM = 1

for i in range(N):

    LCM = LCM * B[i] // gcd(LCM, B[i])

for i in range(N):

    if LCM // B[i] % 2 == 0:

        print((0))

        exit()

print(((M//LCM + 1)//2))
#!/usr/bin/env python3
import sys
from fractions import gcd
import math


def main():
    N, M = list(map(int, input().split()))
    a = list(map(int, input().split()))
    tmp = 1
    count = None
    for i in range(N):
        tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2)
        c = 0
        n = a[i] // 2
        while n % 2 == 0:
            c += 1
            n //= 2
        if i == 0:
            count = c
        elif count != c:
            print((0))
            exit()
    print(((M // tmp + 1) // 2))


if __name__ == "__main__":
    main()

from math import gcd

N, M = list(map(int, input().split()))
A = list(map(int, input().split()))
B = [a // 2 for a in A]
LCM = 1
for i in range(N):
    LCM = LCM * B[i] // gcd(LCM, B[i])
for i in range(N):
    if LCM // B[i] % 2 == 0:
        print((0))
        exit()
print(((M // LCM + 1) // 2))

-#!/usr/bin/env python3 -import sys -from fractions import gcd -import math +from math import gcd - -def main(): -    N, M = list(map(int, input().split())) -    a = list(map(int, input().split())) -    tmp = 1 -    count = None -    for i in range(N): -        tmp = (tmp * a[i] // 2) // gcd(tmp, a[i] // 2) -        c = 0 -        n = a[i] // 2 -        while n % 2 == 0: -            c += 1 -            n //= 2 -        if i == 0: -            count = c -        elif count != c: -            print((0)) -            exit() -    print(((M // tmp + 1) // 2)) - - -if __name__ == "__main__": -    main() +N, M = list(map(int, input().split())) +A = list(map(int, input().split())) +B = [a // 2 for a in A] +LCM = 1 +for i in range(N): +    LCM = LCM * B[i] // gcd(LCM, B[i]) +for i in range(N): +    if LCM // B[i] % 2 == 0: +        print((0)) +        exit() +print(((M // LCM + 1) // 2))