#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll mod = 1e9+7;

int main(){
    int N, X;
    cin >> N >> X;
    vector<int> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];
    sort(S.begin(), S.end());
    reverse(S.begin(), S.end());
    vector<vector<ll>> dp(N+1, vector<ll>(X+1, 0));
    dp[0][X]++;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= X; j++) {
            dp[i+1][j] += (N-1-i)*dp[i][j];
            dp[i+1][j] %= mod;
            dp[i+1][j%S[i]] += dp[i][j];
            dp[i+1][j%S[i]] %= mod;
        }
    }
    ll ans = 0;
    for (int i = 1; i < S[N-1]; i++) ans = (ans + i*dp[N][i])%mod;
    cout << ans << endl;
    return 0;
}