inputs = (gets).split(" ")
$nn = inputs[0].to_i
xx = inputs[1].to_i

inputs = (gets).split(" ")
$si = inputs.map{|istr| istr.to_i}
$minv = $si.min

$selected = []
$total = 0

$fact_memo = Array.new(200){0}
def fact(n)
  if (n <= 0) then
      n = 0
  end
  if ($fact_memo[n] > 0) then
      return $fact_memo[n]
  end
  r = n
  (n-1).downto(1) do |a|
    r = r*a
  end
  if (r<=0) then
      r = 1
  end
  $fact_memo[n] = r
  return r
end
#puts fact(3)

$mod_memo = []
def add_memo(x, y, v)
    if $mod_memo[x].nil? then
        $mod_memo[x] = []
    end
    $mod_memo[x][y] = v
end

def mod_ope(b, na)
  memo = $mod_memo[b][$selected.length] if not $mod_memo[b].nil?
  t = 0

  if not memo.nil? then
  #if false then
      #puts "I know : #{b}, #{$selected.length} => #{memo}"
      $total = $total + memo
      return t
  end
  #p $si
  if ( (b < $minv) || ($selected.length == $nn) ) then
    #p $selected
    #puts "#{b} / #{na} / #{$selected.length}"
    #puts "#{b} * #{$nn-$selected.length}"
    t = b*fact($nn-$selected.length)
    $total = $total + t
    add_memo(b, $selected.length, t)
    return t
  end

  memo = 0

  ($nn).times do |n|
    if not $selected.include?(n) then
      #puts "=> #{n}"
      mo = b.modulo($si[n])
      mo = 0 if mo==$minv
      if (mo < $minv) then
      #if (false) then
        #puts "> #{b} / #{$si[n]}"
        t = mo*fact($nn-$selected.length-1)
        $total = $total + t
        memo = memo + t
        #puts "#{mo} * #{$nn-$selected.length-1}"
      else
        $selected << n
        $si2.delete($si[n])
        #puts "?? #{$si[n]}"
        t = mod_ope(mo, n)
        memo = memo + t
        $selected.delete(n)
        $si2 << $si[n]
      end
    end
  end
  #$selected.delete(na)
  add_memo(b, $selected.length, memo)
  return memo
end

$nn.times do |n|
  #puts "---#{$si[n]}"
  # 小さい順に並び替えてあるのでn番目が一番小さい
  black = xx
  $selected = [n]
  $si2 = $si.dup
  $si2.delete($si[n])
  $si2 << 100001
  mod_ope(xx.modulo($si[n]), n)
end

puts $total.modulo(1000000000+7)