#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;

int main(){
	ll N,X;
	cin >> N >> X;
	vector<ll> S(N);
	FOR(i,0,N)cin>>S[i];
	SORT(S);
	REV(S);
	ll dp[N+2][X+1]={};
	dp[0][X]=1;

	FOR(i,0,N){
		FOR(j,0,X+1){
			(dp[i+1][j%S[i]] += dp[i][j])%=MOD;
			(dp[i+1][j] += dp[i][j]*(N-i-1))%=MOD;
		}
	}
	ll ans = 0;
	FOR(j,1,X+1){
		(ans += dp[N][j]*j)%=MOD;
	}
	cout << ans << endl;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int solve(vector<int> v)
{
    int n=v.size();
    vector<int> l(n,-1);
    stack<array<int,2>> s;
    s.push({-1,-1});
    for(int i=0;i<n;i++)
    {
        while(s.top()[0]>=v[i]) s.pop();
        l[i]=s.top()[1];
        s.push({v[i],i});
    }
    vector<int> r(n,n);
    while(!s.empty()) s.pop();
    s.push({-1,n});
    for(int i=n-1;i>=0;i--)
    {
        while(s.top()[0]>=v[i]) s.pop();
        r[i]=s.top()[1];
        s.push({v[i],i});
    }
    int res=0;
    for(int i=0;i<n;i++) res=max(res,(v[i]+1)*(r[i]-l[i]));
    return res;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int h,w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0;i<h;i++) cin >> s[i];
    vector<vector<int>> sum(h-1,vector<int>(w-1,0));
    for(int i=0;i<h-1;i++) for(int j=0;j<w-1;j++) sum[i][j]=((((s[i][j]=='#')^(s[i][j+1]=='#')^(s[i+1][j]=='#')^(s[i+1][j+1]=='#'))%2)==0);
    int res=max({h,w,solve(sum[h-2])});
    for(int i=h-3;i>=0;i--)
    {
        for(int j=0;j<w-1;j++) if(sum[i][j]==1) sum[i][j]+=sum[i+1][j];
        res=max(res,solve(sum[i]));
    }
    cout << res << "\n";
    return 0;
}
