#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define endl "\n";
using namespace std;

const int INFINT = 2e9;
const ll INFLL = 2e18;

template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

void solve() {
    int N; ll X; cin >> N >> X;

    vector<ll> A(N);
    for (int i=0; i<N; i++) {
        cin >> A[i];
    }

    vector<vector<vector<ll>>> dp(N+1, vector<vector<ll>>(N+1, vector<ll>(N+1, -INFLL)));

    for (int i=0; i<N; i++) {
        ll a = A[i];
        for (int k=N-1; k>0; k--) {
            for (int m=1; m<N+1; m++) {
                for (int r=0; r<m; r++) {
                    if (dp[k][m][r] == -INFLL) continue;
                    chmax(dp[k+1][m][(r+a)%m], dp[k][m][r] + a);
                }
            }
        }
        for (int m=1; m<N+1; m++) {
            chmax(dp[1][m][a%m], a);
        }
    }

    ll ans = INFLL;
    for (int k=1; k<N+1; k++) {
        ll m = dp[k][k][X%k];
        if (m == -INFLL) continue;
        chmin(ans, (X-m)/k);
    }

    cout << ans << endl;

    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
}
#include<bits/stdc++.h>
#define MAX 2000
#define MOD 1000000007
using namespace std;
string v[MAX+10];
int n,m;
long long dp[MAX+10][MAX+10],rig[MAX+10][MAX+10],diag[MAX+10][MAX+10],dow[MAX+10][MAX+10];
int main()
{
	cin>>n>>m;
	for(int i=0;i<n;++i)
		cin>>v[i];
	for(int i=n-1;i>=0;--i)
	{
		for(int j=m-1;j>=0;--j)
		{
			if(v[i][j]=='#')
				continue;
			else if(i==n-1&&j==m-1)
				dp[i][j] = 1;
			else
			{
				dp[i][j] = rig[i][j+1]+diag[i+1][j+1]+dow[i+1][j];
				dp[i][j] %= MOD;
			}
			
			rig[i][j] = dp[i][j]+rig[i][j+1];
			rig[i][j] %=  MOD;
			
			diag[i][j] = dp[i][j]+diag[i+1][j+1];
			diag[i][j] %= MOD;
			
			dow[i][j] = dp[i][j]+dow[i+1][j];
			dow[i][j] %= MOD;
		}
	}
	cout<<dp[0][0]<<endl;
	return 0;
}