Problem:
Score : 600 points

Problem Statement

Snuke has a blackboard and a set S consisting of N integers.
The i-th element in S is S_i.

He wrote an integer X on the blackboard, then performed the following operation N times:

Choose one element from S and remove it.

Let x be the number written on the blackboard now, and y be the integer removed from S. Replace the number on the blackboard with x \bmod {y}.

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

Constraints

All values in input are integers.

1 \leq N \leq 200

1 \leq S_i, X \leq 10^{5}

S_i are pairwise distinct.

Input

Input is given from Standard Input in the following format:

N X
S_1 S_2 \ldots S_{N}

Output

Print the answer.

Sample Input 1

2 19
3 7

Sample Output 1

3

There are two possible orders in which we remove the numbers from S.

If we remove 3 and 7 in this order, the number on the blackboard changes as follows: 19 \rightarrow 1 \rightarrow 1.

If we remove 7 and 3 in this order, the number on the blackboard changes as follows: 19 \rightarrow 5 \rightarrow 2.

The output should be the sum of these: 3.

Sample Input 2

5 82
22 11 6 5 13

Sample Output 2

288

Sample Input 3

10 100000
50000 50001 50002 50003 50004 50005 50006 50007 50008 50009

Sample Output 3

279669259

Be sure to compute the sum modulo 10^{9}+7.

Solution in Fortran (gfortran v4.8.4) (judge verdict: Accepted)

module mod_modulo_operations
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer(8) :: f(0:100000), invf(0:100000)
  integer(8) :: dp(0:200,0:100000)
  integer :: s(200), leq(100000)
contains
  subroutine init(n)
    implicit none
    integer, intent(in) :: n
    integer :: i
    f = 0_8
    invf = 0_8
    f(0) = 1_8
    invf(0) = 1_8
    dp = -1_8
    do i = 1, n
      f(i) = mod(f(i-1)*int(i,8),md)
      invf(i) = inv(f(i))
    end do
    return
  end subroutine init
  integer(8) function perm(n,k)
    implicit none
    integer, intent(in) :: n, k
    perm = 0_8
    if (n.lt.0.or.k.gt.n) return
    perm = mod(f(n)*invf(n-k),md)
    return
  end function perm
  integer(8) function comb(n,k)
    implicit none
    integer, intent(in) :: n, k
    comb = mod(perm(n,k)*invf(k),md)
    return
  end function comb
  function inv(n) result(y)
    implicit none
    integer(8), intent(in) :: n
    integer(8) :: a, b, x, y, t, q
    a = mod(n,md)
    b = md
    x = 0
    y = 1
    do while(b.ne.0_8)
      q = a/b
      t = b
      b = mod(a,b)
      a = t
      t = y
      y = x
      x = t-q*x
    end do
    do while (y.lt.0_8)
      y = y+md
    end do
    y = mod(y,md)
    return
  end function inv
  recursive function dfs(n,x) result(c)
    implicit none
    integer :: n, x, sml, big, i
    integer(8) :: c, k
    c = dp(n,x)
    if (c.ge.0_8) return
    c = int(x,8)
    if (n.eq.0) return
    c = 0_8
    if (x.eq.0) return
    sml = leq(x)
    big = n-sml+1
    c = mod(f(n)*int(x,8),md)
    if (sml.eq.1) return
    k = mod(comb(n,sml-1)*f(big),md)
    c = 0_8
    do i = 1, sml-1
      c = mod(c+dfs(sml-2,mod(x,s(i))),md)
    end do
    c = mod(k*c,md)
    dp(n,x) = c
    return
  end function dfs
end module mod_modulo_operations
program modulo_operations
  use mod_modulo_operations
  implicit none
  integer :: n, x, i, j
  s = 0
  leq = 0
  read(*,*) n, x
  read(*,*) s(1:n)
  call quick_sort(s(1:n))
  j = 1
  do i = 1, 100000
    do while (j.le.n.and.s(j).le.i)
      j = j+1
    end do
    leq(i) = j
  end do
  call init(100000)
  write(*,'(i0)') dfs(n,x)
  stop
contains
  recursive subroutine quick_sort(a)
    implicit none
    integer, intent(inout) :: a(:)
    integer :: n, l, r, p, c
    n = size(a)
    l = 1
    r = n
    p = a((l+r)/2)+a(l)+a(r)-max(a((l+r)/2),a(l),a(r))-min(a((l+r)/2),a(l),a(r))
    do
      do while (a(l).lt.p)
        l = l+1
      end do
      do while (a(r).gt.p)
        r = r-1
      end do
      if (l.ge.r) exit
      c = a(l)
      a(l) = a(r)
      a(r) = c
      l = l+1
      r = r-1
    end do
    if (l.gt.2) call quick_sort(a(1:l-1))
    if (n.gt.r+1) call quick_sort(a(r+1:n))
  end subroutine quick_sort
end program modulo_operations