fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map{it.toInt()}
    val a = readLine()!!.split(" ").map{it.toLong()}

    val b = a.map {
        var k = it
        var cnt = 0
        while(k % 2 == 0L) {
            cnt++
            k /= 2L
        }

        cnt
    }.sorted()

    if (b.first() != b.last()) {
        println(0)
        return
    }

    var l = 1L

    for (i in a.indices) {
        l = lcm(l, a[i])

        if (l > 2 * M) {
            println(0)
            return
        }
    }

    val m = l / 2

    println(1 + (M - m) / l)
}

tailrec fun gcd(x: Long, y: Long): Long = if (y == 0L) x else gcd(y, x % y)

/**
 * Calculate the least common multiple of `x` and `y`
 */
fun lcm(x: Long, y: Long): Long = x / gcd(x, y) * y

