N, X = list(map(int, input().split()))

*V, = list(map(int, input().split()))



MOD = 10**9 + 7



fact = [1]*(X+1)

rfact = [1]*(X+1)

for i in range(X):

    fact[i+1] = r = fact[i] * (i+1) % MOD

    rfact[i+1] = pow(r, MOD-2, MOD)



V.sort()



S = [0]*(X+1)

S[X] = 1

for i in range(N-1, -1, -1):

    T = [0]*(X+1)

    for k in range(X+1):

        S[k] %= MOD

        T[k] += S[k] * i % MOD

        T[k % V[i]] += S[k]

    S = T

print((sum(k*S[k] % MOD for k in range(V[0])) % MOD))
N, X = list(map(int, input().split()))

*V, = list(map(int, input().split()))



MOD = 10**9 + 7



V.sort()



S = [0]*(X+1)

S[X] = 1

T = [0]*(X+1)

zeros = [0]*(X+1)

for i in range(N-1, -1, -1):

    T[:] = zeros

    for k in range(X+1):

        S[k] %= MOD

        T[k] += S[k] * i % MOD

        T[k % V[i]] += S[k]

    S, T = T, S

print((sum(k*S[k] % MOD for k in range(V[0])) % MOD))
N, X = list(map(int, input().split()))
(*V,) = list(map(int, input().split()))
MOD = 10**9 + 7
fact = [1] * (X + 1)
rfact = [1] * (X + 1)
for i in range(X):
    fact[i + 1] = r = fact[i] * (i + 1) % MOD
    rfact[i + 1] = pow(r, MOD - 2, MOD)
V.sort()
S = [0] * (X + 1)
S[X] = 1
for i in range(N - 1, -1, -1):
    T = [0] * (X + 1)
    for k in range(X + 1):
        S[k] %= MOD
        T[k] += S[k] * i % MOD
        T[k % V[i]] += S[k]
    S = T
print((sum(k * S[k] % MOD for k in range(V[0])) % MOD))

N, X = list(map(int, input().split()))
(*V,) = list(map(int, input().split()))
MOD = 10**9 + 7
V.sort()
S = [0] * (X + 1)
S[X] = 1
T = [0] * (X + 1)
zeros = [0] * (X + 1)
for i in range(N - 1, -1, -1):
    T[:] = zeros
    for k in range(X + 1):
        S[k] %= MOD
        T[k] += S[k] * i % MOD
        T[k % V[i]] += S[k]
    S, T = T, S
print((sum(k * S[k] % MOD for k in range(V[0])) % MOD))

-fact = [1] * (X + 1) -rfact = [1] * (X + 1) -for i in range(X): -    fact[i + 1] = r = fact[i] * (i + 1) % MOD -    rfact[i + 1] = pow(r, MOD - 2, MOD) +T = [0] * (X + 1) +zeros = [0] * (X + 1) -    T = [0] * (X + 1) +    T[:] = zeros -    S = T +    S, T = T, S