using System; using System.Collections.Generic; using static System.Console; using System.Linq; class yuki321 { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); static void Main() { var c = NList; var (n, k) = ((int)c[0], c[1]); var a = NList; var gcda = new long[n]; for (var i = 0; i < n; ++i) gcda[i] = GCD(k, a[i]); var key = 1000000007; var divs = Divs(k); var dic = new Dictionary(); for (var i = 0; i < divs.Count; ++i) dic[divs[i]] = i; var dp = new long[divs.Count]; dp[0] = 1; for (var i = 0; i < n; ++i) { var next = (long[]) dp.Clone(); for (var j = 0; j < dp.Length; ++j) { var nj = dic[GCD(gcda[i] * divs[j], k)]; next[nj] = (next[nj] + dp[j]) % key; } dp = next; } WriteLine(dp.Last()); } static long GCD(long a, long b) { if (a < b) return GCD(b, a); if (a % b == 0) return b; return GCD(b, a % b); } static List Divs(long a) { var list = new List(); var rev = new List(); for (var i = 1; i * i <= a; ++i) { if (a % i == 0) { list.Add(i); if (i * i < a) rev.Add(a / i); } } rev.Reverse(); list.AddRange(rev); return list; } }