import java.util.*; import java.io.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); HashMap counts = new HashMap<>(); for (int i = 0; i < n; i++) { int x = getGCD(sc.nextLong(), k); HashMap next = new HashMap<>(); for (int y : counts.keySet()) { int z = getGCD((long)x * y, k); next.put(z, (next.getOrDefault(z, 0) + counts.get(y)) % MOD); } for (int y : next.keySet()) { counts.put(y, (counts.getOrDefault(y, 0) + next.get(y)) % MOD); } counts.put(x, (counts.getOrDefault(x, 0) + 1) % MOD); } System.out.println(counts.getOrDefault(k, 0)); } static int getGCD(long x, long y) { if (x % y == 0) { return (int)y; } else { return getGCD(y, x % y); } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String nextLine() throws Exception { return br.readLine(); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }