Arrays and gcd

Count arrays arr with elements in [1, num] whose running gcd array equals the given array C, modulo 1e9+7.

Medium7Number theoryDynamic programmingMathCombinatoricsNo attempts yetTime limit0.5sMemory limit128 MB

Problem

There are two integer arrays of size NN, called arrarr and CC. They satisfy the following relation.

C[0]=arr[0],C[i]=gcd(C[i1],arr[i])(1iN1)C[0] = arr[0], \qquad C[i] = \gcd(C[i-1],\, arr[i]) \quad (1 \le i \le N-1)

Here gcd(x,y)\gcd(x, y) is the greatest common divisor of xx and yy.

For example, arr=[16,16,8,16,2]arr = [16, 16, 8, 16, 2] gives C=[16,16,8,8,2]C = [16, 16, 8, 8, 2].

Given the array CC, find the number of arrays arrarr that produce it, modulo 10000000071000000007 (109+710^9+7). Every element of arrarr is an integer between 11 and numnum.

Input

The first line contains two integers NN (1N1051 \le N \le 10^5) and numnum (1num1091 \le num \le 10^9), separated by a space.

The second line contains the elements of the array CC, that is C[0],C[1],,C[N1]C[0], C[1], \ldots, C[N-1], separated by spaces. (1C[i]num1 \le C[i] \le num)

Output

Print the number of arrays arrarr that satisfy the conditions, modulo 109+710^9+7, on the first line.