#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
#define rprintf(fmt, begin, end) do { const auto end_rp = (end); auto it_rp = (begin); for (bool sp_rp=0; it_rp!=end_rp; ++it_rp) { if (sp_rp) putchar(' '); else sp_rp = true; printf(fmt, *it_rp); } putchar('\n'); } while(0)

int N;
LL A[101];
LL X;

LL dp[101][101];

void MAIN() {
    scanf("%d%lld", &N, &X);
    REP (i, N) scanf("%lld", A+i);
    LL ans = 1LL<<60;
    REP (i, N) {
	amin(ans, X - A[i]);
    }

    for (int B=2; B<=N; B++) {
	memset(dp, 0xc0, sizeof dp);

	dp[0][0] = 0;
	REP (i, N) {
	    int v = A[i] % B;
	    for (int c=i; c>=0; c--) {
		REP (j, B) {
		    amax(dp[c+1][(j+v) % B], dp[c][j] + A[i]);
		}
	    }
	}

	REP (j, B) if (dp[B][j] >= 0 && (X-j) % B == 0) {
	    assert((X-dp[B][j]) % B == 0);
	    LL tmp = (X-dp[B][j]) / B;
	    amin(ans, tmp);
	}
    }

    if (ans == (1LL<<60)) {
	puts("-1");
    } else {
	printf("%lld\n", ans);
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}


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

const ll INF = 1e18;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

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

	ll ans = INF;
	for (int i=1;i<=N;i++) {
		// dp[a][b][c]: a番目まで見て、b個とって、val = c(mod i) のときの値の最大値
		vector<vector<vector<ll>>> dp(N+1, vector<vector<ll>>(i+1, vector<ll>(i, -1)));
		dp[0][0][0] = 0LL;
		for (int a=0;a<N;a++) {
			for (int b=0;b<=i;b++) {
				for (int c=0;c<i;c++) {
					if (dp[a][b][c] == -1) continue;
					dp[a+1][b][c] = max(dp[a+1][b][c], dp[a][b][c]);
					if (b+1 > i) continue;
					dp[a+1][b+1][(c+A[a])%i] = max(dp[a+1][b+1][(c+A[a])%i], dp[a][b][c]+A[a]);
				}
			}
		}

		if (dp[N][i][(X%i)] == -1) continue;
		ans = min(ans, (X-dp[N][i][(X%i)])/i);
	}
	cout << ans << "\n";
	return 0;
}