#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 <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <complex>

using namespace std;

//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")


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

	long long n, x, i, j, k, kk, ans, INF = 1LL << 60, kv;
	cin >> n >> x;
	vector<long long> a(n);
	for (i = 0; i < n; i++) cin >> a[i];

	ans = INF;
	for (kk = 1; kk <= n; kk++) {
		// step, count, mod kk
		vector<vector<vector<long long>>> dp(n + 1, vector<vector<long long>>(kk + 1, vector<long long>(kk, -INF)));
		
		dp[0][0][0] = 0;
		for (i = 0; i < n; i++) {
			for (j = 0; j <= kk; j++) {
				for (k = 0; k < kk; k++) {
					dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
					kv = (k + a[i]) % kk;
					if (j < kk) dp[i + 1][j + 1][kv] = max(dp[i + 1][j + 1][kv], dp[i][j][k] + a[i]);
				}
			}
		}

		if (dp[n][kk][x % kk] > 0) {
			ans = min(ans, (x - dp[n][kk][x % kk]) / kk);
		}
	}

	cout << ans << "\n";



	return 0;
}

