#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <ctime>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 1LL << 62
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

ll pow_mod(ll a, ll b, ll m){
    ll ret = 1;
    while (b > 0) {
        if (b & 1) {
            ret = ret * a % m;
        }
        a = a * a % m;
        b >>= 1;
    }
    return ret;
}

ll inv_mod(ll a, ll m){
    return pow_mod(a, m - 2, m);
}

const int MAX_M = 100001;

ll f[MAX_M];

void calc() {
    f[0] = 1;
    rep(i, 1, MAX_M) {
        f[i] = f[i - 1] * i;
        f[i] %= mod;
    }
}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    calc();
    int N;
    ll X;
    cin >> N >> X;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    sort(all(A));
    reverse(all(A));
    
    vector<ll> dp(MAX_M);
    vector<ll> tmp(MAX_M);
    dp[X] = 1;
    rep(i, N) {
        tmp.assign(MAX_M, 0);
        ll inv = inv_mod(N - i, mod);
        rep(j, MAX_M) {
            tmp[j % A[i]] += dp[j] * inv % mod;
            tmp[j % A[i]] %= mod;
            tmp[j] += (dp[j] * inv % mod) * (N - i - 1) % mod;
            tmp[j] %= mod;
        }
        dp = tmp;
    }
    
    ll ans = 0;
    rep(i, MAX_M) {
        ans += dp[i] * i;
        ans %= mod;
    }
    ans *= f[N];
    ans %= mod;
    output(ans);
    
    return 0;
}


#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <bitset>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()

#pragma region UnionFind
struct UnionFind
{
	vector<int> par;

	UnionFind(int n) : par(n, -1) {}
	void init(int n) { par.assign(n, -1); }

	int root(int x)
	{
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool issame(int x, int y)
	{
		return root(x) == root(y);
	}

	bool merge(int x, int y)
	{
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x)
	{
		return -par[root(x)];
	}
};
#pragma endregion
#pragma region GCD
int gcd(int a, int b)
{
	if (a%b == 0)return b;
	return gcd(b, a%b);
}
#pragma endregion
#pragma region chmin
template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma region chmax
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}
#pragma endregion
#pragma endregion

int main()
{
	int l, r; cin >> l >> r;
	if (r - l + 1 >= 2019 || l == 0)cout << 0 << endl;
	else
	{
		int res = 1e7;
		for (int i = l; i < r; ++i)
		{
			for (int j = i + 1; j <= r; ++j)
			{
				chmin(res, ((i % 2019)*(j % 2019)) % 2019);
			}
		}
		cout << res << endl;
	}
}