import std.algorithm, std.array, std.conv, std.numeric, std.stdio, std.string;

void main()
{
    auto m = readln.chomp.split[1].to!int;
    auto a = readln.chomp.split.to!(ulong[]);
    while (a.all!(e => e % 4 == 0))
    {
        a[] /= 2;
        m /= 2;
    }
    stderr.writeln(a);
    assert (a.any!(e => e % 4));
    if (a.any!(e => e % 4 == 0))
    {
        return "0".writeln;
    }
    auto l = reduce!lcm(1UL, a);
    ((m + l/2) / l).writeln;
}
ulong lcm(ulong a, ulong b)
{
    return a / gcd(a, b) * b;
}