from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree

from scipy.sparse import csr_matrix, coo_matrix, lil_matrix

import numpy as np

from collections import deque, Counter, defaultdict

from itertools import product, permutations,combinations

from operator import itemgetter

from heapq import heappop, heappush

from bisect import bisect_left, bisect_right, bisect

from fractions import gcd

from math import ceil,floor, sqrt, cos, sin, pi, factorial

from functools import reduce

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10**8)

INF = float('inf')

MOD = 10**9+7

def lcm_base(a, b):

    return (a * b) // gcd(a, b)



def lcm_list(numbers):

    return reduce(lcm_base, numbers, 1)





def main():

  n, m = list(map(int, readline().split()))

  a = np.array(input().split(), np.int64)

  a //= 2

  b=np.copy(a)

  while True:

    c = b%2

    if c.sum() == 0:

      b //= 2

    elif c.sum() == n:

      break

    else:

      print((0))

      sys.exit()

  d = lcm_list(a)

  if d>10**9:

    ans = 0

  else:

    ans = (m//d) - (m//(d+d))

  print(ans)

  

  

  

if __name__ == '__main__':

  main()
import sys

from math import gcd

from functools import reduce

import numpy as np

    

read = sys.stdin.read

readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)

INF = float('inf')

MOD = 10 ** 9 + 7





def lcm_base(a, b):

    return (a * b) // gcd(a, b)





def lcm_list(numbers):

    return reduce(lcm_base, numbers, 1)





def main():

    n, m = list(map(int, readline().split()))

    a = np.array(input().split(), np.int64)

    a //= 2

    b = np.copy(a)

    while True:

        c = b % 2

        if c.sum() == 0:

            b //= 2

        elif c.sum() == n:

            break

        else:

            print((0))

            sys.exit()

    d = lcm_list(a)

    if d > 10 ** 9:

        ans = 0

    else:

        ans = (m // d) - (m // (d + d))

    print(ans)





if __name__ == '__main__':

    main()

from scipy.sparse.csgraph import (
    shortest_path,
    floyd_warshall,
    dijkstra,
    bellman_ford,
    johnson,
    minimum_spanning_tree,
)
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from collections import deque, Counter, defaultdict
from itertools import product, permutations, combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil, floor, sqrt, cos, sin, pi, factorial
from functools import reduce
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7


def lcm_base(a, b):
    return (a * b) // gcd(a, b)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
    n, m = list(map(int, readline().split()))
    a = np.array(input().split(), np.int64)
    a //= 2
    b = np.copy(a)
    while True:
        c = b % 2
        if c.sum() == 0:
            b //= 2
        elif c.sum() == n:
            break
        else:
            print((0))
            sys.exit()
    d = lcm_list(a)
    if d > 10**9:
        ans = 0
    else:
        ans = (m // d) - (m // (d + d))
    print(ans)


if __name__ == "__main__":
    main()

import sys
from math import gcd
from functools import reduce
import numpy as np

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)
INF = float("inf")
MOD = 10**9 + 7


def lcm_base(a, b):
    return (a * b) // gcd(a, b)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
    n, m = list(map(int, readline().split()))
    a = np.array(input().split(), np.int64)
    a //= 2
    b = np.copy(a)
    while True:
        c = b % 2
        if c.sum() == 0:
            b //= 2
        elif c.sum() == n:
            break
        else:
            print((0))
            sys.exit()
    d = lcm_list(a)
    if d > 10**9:
        ans = 0
    else:
        ans = (m // d) - (m // (d + d))
    print(ans)


if __name__ == "__main__":
    main()

-from scipy.sparse.csgraph import ( -    shortest_path, -    floyd_warshall, -    dijkstra, -    bellman_ford, -    johnson, -    minimum_spanning_tree, -) -from scipy.sparse import csr_matrix, coo_matrix, lil_matrix +import sys +from math import gcd +from functools import reduce -from collections import deque, Counter, defaultdict -from itertools import product, permutations, combinations -from operator import itemgetter -from heapq import heappop, heappush -from bisect import bisect_left, bisect_right, bisect -from fractions import gcd -from math import ceil, floor, sqrt, cos, sin, pi, factorial -from functools import reduce -import sys -read = sys.stdin.buffer.read +read = sys.stdin.read -readlines = sys.stdin.buffer.readlines