#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <chrono>
#include <climits>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

template <class T1, class T2>
ostream& operator << (ostream& out, const pair <T1, T2> p)
{
	return out << '(' << p.first << ',' << p.second << ')';
}

template <class T1, class T2>
istream& operator >> (istream& in, pair<T1, T2> &p)
{
	return in >> p.first >> p.second;
}

template <class T>
istream& operator >> (istream& in, vector<T> &v)
{
	for (T &x : v)
		in >> x;
	return in;
}

template <class T>
ostream& operator << (ostream& out, const vector<vector<T>> &v)
{
	for (const vector<T> &x : v)
		out << x << '\n';
	return out;
}

template <class T>
ostream& operator << (ostream& out, const vector<T> &v)
{
	for (const T &x : v)
		out << x << ' ';
	return out;
}

long long gcd (long long a, long long b)
{
	if (b > a)
		swap(a, b);
	return (b ? gcd(b, a % b) : a);
}

using ll   = long long;
using pii  = pair<int, int>;
using pll  = pair<long long, long long>;
using tiii = pair<pair<int, int>, int>;
using vi   = vector<int>;
using vl   = vector<long long>;
using vvi  = vector<vector<int>>;
using vvl  = vector<vector<long long>>;

#define F          first
#define S          second
#define First      first.first
#define Second     first.second
#define Third      second
#define mp         make_pair
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define per(i,b,a) for (int i = (b); i > (a); i--)
#define all(x)     x.begin(), x.end()
#define ret(x)     return cout << x, 0;
#define throwex    throw runtime_error ("Found the error.");

const int h = 1000000007;

signed main()
{
	ios::sync_with_stdio(false);
	#ifdef ONLINE_JUDGE
	cin.tie(nullptr);
	cerr.setstate(ios::failbit);
	#endif

	int n;
	cin >> n;
	ll x;
	cin >> x;
	vl v(n);
	cin >> v;
	ll ans = LLONG_MAX;
	rep(num,1,n+1)
	{
		vvl dp(num + 1, vl(num, -1));
		dp[0][0] = 0;
		for(ll x : v)
			per(i,num-1,-1)
				rep(j,0,num)
					if(dp[i][j] != -1)
						dp[i + 1][(j + x) % num] = max(dp[i + 1][(j + x) % num], dp[i][j] + x);
		if(dp.back()[x % num] != -1)
			ans = min(ans, (x - dp.back()[x % num]) / num);
	}
	cout << (ans == LLONG_MAX ? -1 : ans);
}

#include <iostream>
using namespace std;

using ll = long long;

const ll INF = 1e18+20;

ll d[101][101][101][101];
ll a[101];

int main() {
    int n;
    ll x;
    cin >> n >> x;
    for (int i = 1; i <= n; i++){cin>>a[i];}
    for (int i=0; i<=n; i++) {
        for (int k=0; k<=n;k++) {
            for (int p=0; p<=n; p++) {
                for (int r=0; r<=n; r++) {
                    d[i][k][p][r]=-1;
                }
            }
        }
    }
    for (int p=1; p<=n; p++) {
        d[0][0][p][0] = 0;
    }
    for (int i = 1; i <= n; i++) {
        for (int k = 1; k <= i; k++) {
            for (int p = 1; p <= n; p++) {
                for (int r = 0; r < p; r++) {
                    d[i][k][p][r] = d[i-1][k][p][r];
                    ll from=d[i-1][k-1][p][(r-a[i]%p+p)%p];
                    if (from != -1 && from + a[i] > d[i][k][p][r]) {
                        d[i][k][p][r] = from + a[i];
                    }
                }
            }
        }
    }
    ll result = INF;
    for (int k=1; k<=n; k++) {
        if (d[n][k][k][x%k] == -1) {
            continue;
        }
        ll cur = (x - d[n][k][k][x%k]) / k;
        if (cur < result) {
            // cout << "hey " << k  << " " << x % k << " " << d[n][k][k][x%k] << "\n";
            result = cur;
        }
    }
    cout << result;
    // cout << "\n===================\n";
    // cout << "r=1: " << d[3][2][[1] << "\n";
    // cout << "\n=====\n";
    // cout << d[1][1][1][0] << "\n";
    // cout << d[0][];
 	return 0;
}