N, X = gets.chomp.split(" ").map(&:to_i)
S = gets.chomp.split(" ").map(&:to_i)

total = 0
S.permutation(N) { |arr|
    x = X
    arr.each { |i|
        x = x % i
    }
    total += x
} 

puts total % (10**9 + 7)