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

const ll MIN = -1e18;

int main() {
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	int n;
	ll m, ans = 1e18;
	
	cin >> n >> m;
	
	vector<ll> a(n);
	for (ll& x : a) cin >> x;

	for (int k = 1; k <= n; ++k) {
		vector<vector<ll>> dp(k, vector<ll>(k+1, MIN));
		dp[0][0] = 0;
		for (ll x : a) {
			for (int c = k; c >= 1; --c) {
				for (int r = 0; r < k; ++r) {
					if (dp[(r-x%k+k)%k][c-1] >= 0) {
						dp[r][c] = max(dp[r][c], dp[(r-x%k+k)%k][c-1] + x);
					}
				}
			}
		}
		if (dp[m%k][k] < 0) continue;
		ans = min(ans, (m - dp[m%k][k])/k);
	}

	cout << ans;

	return 0;
}

#include <iostream>
#include <vector>
#include <limits>
#include <cstring>
#include <time.h>
#include <math.h>
#include <algorithm>
#include <random>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <chrono>
#include <sstream>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pii;
typedef vector<pii > vii;
typedef vector<vector<ll> > vvi;
typedef vector<vvi > vvvi;
typedef vector<vector<pair<ll, ll> > > vvii;
typedef ll func_ii_i(ll, ll);

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,s,e) for(ll i=(s);i<(e);++i)
#define repr(i,s,e) for(ll i=(e);i>(s);--i)
#define io do { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout.precision(10); } while (0)
#define endl '\n'
#define newl cout << '\n';

#define fill0(a) memset(a, 0, sizeof(a))
#define fill1(a) memset(a, -1, sizeof(a))

#define all(v) v.begin(), v.end()
#define bg begin()
#define ed end()
#define tr(it, v) for (auto it = v.bg; it != v.ed; it++)
#define prv(v) do { tr(it, v) { cout << *it << " "; }; cout << endl; } while (0)
#define prm(m) tr(it, m) { cout << it->first << " -> " << it->second << endl; }
#define scan(a, n) rep(_idx,0,n) cin >> a[_idx];
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define sumv(v) accumulate(all(v), 0ll)
#define ub(a, x) upper_bound(all(a), x)
#define lb(a, x) lower_bound(all(a), x)

#define tcT template<class T

ll min3(ll a, ll b, ll c) { return min(a, min(b, c)); }
ll max3(ll a, ll b, ll c) { return max(a, max(b, c)); }
ll mid3(ll a, ll b, ll c) { return a + b + c - min3(a, b, c) - max3(a, b, c); }
ll ceil1(ll x, ll y) { if(x % y) return (x + y) / y; else return x / y; }
tcT> void rmdup(vector<T> &v) { sort(all(v)); v.erase(unique(all(v)), v.ed); }
tcT> ll fst1(ll l, ll h, T f) {
	++h; // f is increasing
	while(l<h) {
		ll mi = l + ((h - l) >> 1);
		f(mi) ? h = mi : l = mi + 1;
	}
	return l;
}
tcT> ll lst1(ll l, ll h, T f) {
	--l; // f is decreasing
	while(l<h) {
		ll mi = l + ((h - l + 1) >> 1);
		f(mi) ? l = mi : h = mi - 1;
	}
	return l;
}

const ll MOD = 1e9+7;
const ll INF = 1e16;
const ll TE3 = 1005;
const ll TE5 = 300005;
const ll dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
const string YN[2] = {"NO", "YES"};

using namespace std;

ll dp[105][105][105];

ll g(vi &v,ll n,ll k,ll x,ll rem,ll t) {
	if(rem==0 && t==0) {
		return 0;
	}
	if(rem<=0) {
		return -INF;
	}
	if(x<0) {
		return -INF;
	}
	if(dp[x][rem][t]!=-1) {
		return dp[x][rem][t];
	}
	ll e=v[x];
	ll em=e%k;
	ll nm=(t-em+k)%k;
	ll ans=g(v,n,k,x-1,rem,t);
	ans=max(ans,e+g(v,n,k,x-1,rem-1,nm));
	return dp[x][rem][t]=ans;
}

int main()
{
	io;
	ll n,x;
	cin>>n>>x;
	vi v(n);
	scan(v,n);

	ll ans=-1;
	rep(k,1,n+1) {
		ll t=x%k;
		fill1(dp);
		ll su=g(v,n,k,n-1,k,t);
		if(su<0) {
			continue;
		}
		ll local=(x-su)/k;
		if(ans==-1) {
			ans=local;
		} else {
			ans=min(ans,local);
		}
	}
	cout<<ans<<endl;
	return 0;
}
