atcoder#EXAWIZARDS2019D. Modulo Operations

Modulo Operations

Score : 600600 points

Problem Statement

Snuke has a blackboard and a set SS consisting of NN integers. The ii-th element in SS is SiS_i.

He wrote an integer XX on the blackboard, then performed the following operation NN times:

  • Choose one element from SS and remove it.
  • Let xx be the number written on the blackboard now, and yy be the integer removed from SS. Replace the number on the blackboard with xmodyx \bmod {y}.

There are N!N! possible orders in which the elements are removed from SS. For each of them, find the number that would be written on the blackboard after the NN operations, and compute the sum of all those N!N! numbers modulo 109+710^{9}+7.

Constraints

  • All values in input are integers.
  • 1N2001 \leq N \leq 200
  • 1Si,X1051 \leq S_i, X \leq 10^{5}
  • SiS_i are pairwise distinct.

Input

Input is given from Standard Input in the following format:

NN XX

S1S_1 S2S_2 \ldots SNS_{N}

Output

Print the answer.

2 19
3 7
3
  • There are two possible orders in which we remove the numbers from SS.
  • If we remove 33 and 77 in this order, the number on the blackboard changes as follows: 191119 \rightarrow 1 \rightarrow 1.
  • If we remove 77 and 33 in this order, the number on the blackboard changes as follows: 195219 \rightarrow 5 \rightarrow 2.
  • The output should be the sum of these: 33.
5 82
22 11 6 5 13
288
10 100000
50000 50001 50002 50003 50004 50005 50006 50007 50008 50009
279669259
  • Be sure to compute the sum modulo 109+710^{9}+7.