#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	ll X; cin >> X;
	vector<int> a(n);
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	sort(a.rbegin(), a.rend());
	ll res=X-a[0];
	for(int k=2;k<=n;k++){
		vector<vector<int>> dp(k+1,vector<int>(k,-1));
		dp[0][0]=0;
		for(int i=0;i<n;i++){
			for(int j=k-1;j>=0;j--){
				for(int l=0;l<k;l++){
					if(dp[j][l]<0)continue;
					int nx=(l+a[i])%k;
					dp[j+1][nx]=max(dp[j+1][nx],dp[j][l]+a[i]);
				}
			}
		}
		if(dp[k][X%k]>=0){
			res=min(res,(ll)(X-dp[k][X%k])/k);
		}
	}
	cout << res << endl;
}
#include<bits/stdc++.h>
using namespace std;
#define _rep(i, x, y) for(int i = (int)x; i < (int)y; ++i)
#define _dep(i,x,y) for(int i = (int)x; i > (int)y; i--)
#define PII pair<int,int>
#define eb emplace_back
#define pb push_back
#define fi first
#define se second
#define PQ priority_queue
#define lb lower_bound
#define ub upper_bound
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VII;
typedef vector<ll> VL;
typedef vector<vector<ll>> VLL;
constexpr int mod = 1e9 + 7;
constexpr ll KINF = 1e18;
constexpr double eps = 1e-7;
int main(){
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	ll x;
	cin >> n >> x;
	VI a(n);
	_rep(i, 0, n) cin >> a[i];
	auto check = [&](int k){
		int rem = x % k;
		int b[n];
		_rep(i, 0, n) b[i] = a[i] % k;
		int dp[n + 1][k + 1][k + 1];
		memset(dp, -0x3f, sizeof dp);
		_rep(i, 0, n + 1) dp[i][0][0] = 0;
		_rep(i, 1, n + 1)
			_rep(j, 1, k + 1)
				_rep(z, 0, k){
					dp[i][j][z] = dp[i - 1][j][z];
					if(z - b[i - 1] >= 0) dp[i][j][z] = max(dp[i][j][z], dp[i - 1][j - 1][z - b[i - 1]] + a[i - 1]);
					else dp[i][j][z] = max(dp[i][j][z], dp[i - 1][j - 1][z + k - b[i - 1]] + a[i - 1]);
					if(dp[n][k][rem] == x) return 0;
				}
		return dp[n][k][rem];
	};
	int res = -1;
	vector<PII> ans;
	_dep(k, n, 1){
		res = check(k);
		if(res > 0) {
			ans.eb(res, k);
		}
		if(res == 0){
			cout << 0 << endl;
			return 0;
		}
	}
	if(ans.empty()) {
		sort(all(a));
		// auto  it = lb(all(a), x);
		// if(it != a.end()) cout << x - *it << endl;
		// else cout << x - a[n - 1] << endl;
		cout << x - a[n - 1] << endl;
		return 0;
	}
	else{
		ll res = KINF;
		for(auto& [ini, div] : ans){
			res = min(res, (x - ini) / div);
		}
		cout << res << endl;
	}
	return 0;
} 
// 小心左移运算符导致的int溢出
// dp记得处理非法状态
// resize并不会初始化数组
// 全局函数一定要记得inline
// 带空格字符串不能直接cin,要用getline

