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

const int N = 110;

int n;
ll X, dp[N][N][N], ans = 1e18, a[N];

int main(){
	cin >> n >> X;
	for(int i = 1; i <= n; ++ i)	cin >> a[i];
	for(int t = 1; t <= n; ++ t){	//一共选t个 
		memset(dp, 0xcf, sizeof dp);
		dp[0][0][0] = 0;
		for(int i = 1; i <= n; ++ i){		//前i个物品中选 
			dp[i][0][0] = 0;
			for(int k = 1; k <= min(i, t); ++ k){	//选k个 
				for(int j = 0; j < t; ++ j)
					dp[i][k][j] = max(dp[i - 1][k][j], dp[i - 1][k - 1][((j - a[i]) % t + t) % t] + a[i]); 
			} 
		}
		if(dp[n][t][X % t] >= 0)	ans = min(ans, (X - dp[n][t][X % t]) / t);
	}
	cout << ans;
	return 0;
}
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef  long long  int ll;
typedef long double db;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pll pair<ll,ll>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ub(v,val) upper_bound(v.begin(),v.end(),val)
#define np(str) next_permutation(str.begin(),str.end())
#define lb(v,val) lower_bound(v.begin(),v.end(),val)
#define sortv(vec) sort(vec.begin(),vec.end())
#define rev(p) reverse(p.begin(),p.end());
#define v vector
#define pi 3.14159265358979323846264338327950288419716939937510
#define len length()
#define repc(i,s,e) for(ll i=s;i<e;i++)
#define fi first
#define se second
#define mset(a,val) memset(a,val,sizeof(a));
#define mt make_tuple
#define repr(i,n) for(i=n-1;i>=0;i--)
#define rep(i,n) for(i=0;i<n;i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define at(s,pos) *(s.find_by_order(pos))
#define set_ind(s,val) s.order_of_key(val)
long long int M = 1e9 + 7 ;
long long int inf = 9 * 1e18;
//CLOCK
ll begtime = clock();
#define time() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//CLOCK ENDED
ll n, m;
// modular exponentiation
ll binpow(ll val, ll deg)
{
	if (deg < 0)
		return 0;
	if (!deg)
		return 1 % M;
	if (deg & 1)
		return binpow(val, deg - 1) * val % M;
	ll res = binpow(val, deg >> 1);
	return (res * res) % M;
}
//binomial
ll modinv(ll n) {
	return binpow(n, M - 2);
}
//DEBUGGING
vector<string> vec_splitter(string s)
{
	s += ',';
	vector<string> res;
	while (!s.empty())
	{
		res.push_back(s.substr(0, s.find(',')));
		s = s.substr(s.find(',') + 1);
	}
	return res;
}
void debug_out(
    vector<string> __attribute__((unused)) args,
    __attribute__((unused)) int idx,
    __attribute__((unused)) int LINE_NUM) { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T)
{
	if (idx > 0)
		cout << " | ";
	else
		cout << "Line(" << LINE_NUM << ") ";
	stringstream ss;
	ss << H;
	cout << args[idx] << " = " << ss.str();
	debug_out(args, idx + 1, LINE_NUM, T...);
}
#ifndef ONLINE_JUDGE
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
#else
#define debug(...) 42
#endif
// DEBUGGING ENDED
int main() {
	// your code goes here
	IOS;
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll i, j, t, k, x, y, z,  N;
	cin >> n >> x;
	ll a[n];
	rep(i, n) {
		cin >> a[i];
		// cout << a[i] << ' ';
	}
	ll mn = inf;
	for (ll C = 1; C <= n; C++) {
		ll dp[n + 5][n + 5][n + 5];
		mset(dp, -1);
		dp[0][0][0] = 0;
		for (i = 0; i < n; i++)
		{
			for (j = 0; j <= n; j++) {
				for (k = 0; k <= n; k++) {
					if (dp[i][j][k] != -1) {
						dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
						if (j < n) {
							y = dp[i][j][k] + a[i];
							ll to = (x - y) % C;
							dp[i + 1][j + 1][to] = max(dp[i + 1][j + 1][to], y);
						}
					}
				}
			}
		}
		if (dp[n][C][0] != -1) {
			mn = min(mn, (x - dp[n][C][0]) / C);
		}
	}
	if (mn == inf) cout << -1;
	else cout << mn;



	return 0;


}




















