from fractions import gcd

from functools import reduce





def lcm(a, b):

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





def solve(string):

    n, m, *a = list(map(int, string.split()))

    l = reduce(lcm, a)

    while a[0] % 2 == 0:

        c = a[0] % 2

        for _a in a[1:]:

            if _a % 2 != c:

                return "0"

        if not c:

            a = [_a // 2 for _a in a]

    c = a[0] % 2

    for _a in a[1:]:

        if _a % 2 != c:

            return "0"

    return str(max((m - l // 2) // l + 1, 0))





if __name__ == '__main__':

    import sys

    print((solve(sys.stdin.read().strip())))

from fractions import gcd

from functools import reduce





def lcm(a, b):

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





def solve(string):

    n, m, *a = list(map(int, string.split()))

    l = reduce(lcm, a)

    c = 1

    while a[0] % (2 * c) == 0:

        c *= 2

    a = [_a // c if _a % c == 0 else 0 for _a in a]

    for _a in a:

        if not _a or _a % 2 != a[0] % 2:

            return "0"

    return str(max((m - l // 2) // l + 1, 0))





if __name__ == '__main__':

    import sys

    print((solve(sys.stdin.read().strip())))

from fractions import gcd
from functools import reduce


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


def solve(string):
    n, m, *a = list(map(int, string.split()))
    l = reduce(lcm, a)
    while a[0] % 2 == 0:
        c = a[0] % 2
        for _a in a[1:]:
            if _a % 2 != c:
                return "0"
        if not c:
            a = [_a // 2 for _a in a]
    c = a[0] % 2
    for _a in a[1:]:
        if _a % 2 != c:
            return "0"
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == "__main__":
    import sys

    print((solve(sys.stdin.read().strip())))

from fractions import gcd
from functools import reduce


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


def solve(string):
    n, m, *a = list(map(int, string.split()))
    l = reduce(lcm, a)
    c = 1
    while a[0] % (2 * c) == 0:
        c *= 2
    a = [_a // c if _a % c == 0 else 0 for _a in a]
    for _a in a:
        if not _a or _a % 2 != a[0] % 2:
            return "0"
    return str(max((m - l // 2) // l + 1, 0))


if __name__ == "__main__":
    import sys

    print((solve(sys.stdin.read().strip())))

-    while a[0] % 2 == 0: -        c = a[0] % 2 -        for _a in a[1:]: -            if _a % 2 != c: -                return "0" -        if not c: -            a = [_a // 2 for _a in a] -    c = a[0] % 2 -    for _a in a[1:]: -        if _a % 2 != c: +    c = 1 +    while a[0] % (2 * c) == 0: +        c *= 2 +    a = [_a // c if _a % c == 0 else 0 for _a in a] +    for _a in a: +        if not _a or _a % 2 != a[0] % 2: