#include<iostream>
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<>, rb_tree_tag,tree_order_statistics_node_update>

#define ll long long
#define FOR(i,a,b)  for(ll i=a;i<=b;i++)
#define FORR(i,a,b)  for(ll i=a;i>=b;i--)
#define vl vector<ll>
#define ld long double
#define vld vector<ld>
#define vvl vector<vector<long long>>
#define vvld vector<vector<ld>>
#define pll pair<long,long>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb(v,x) lower_bound(v.begin(),v.end(),x)
#define ub(v,x) upper_bound(v.begin(),v.end(),x)
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.14159265358979323846264338327950288419716939937510
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define rev(p) reverse(p.begin(),p.end());
#define mset(a,val) memset(a,val,sizeof(a));
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)
#define sz(x) ((ll)x.size())
const ll M = 1000000007;
const ll MM = 998244353;
#define endl "\n"
ll begtime = clock();
#define end_routine() cout << "\n\nTime elapsed: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename T, typename F>
void chmax( T &a, F b) {
  if (b > a)a = b;
}

template<typename T, typename F>
void chmin( T &a, F b) {
  if (b < a)a = b;
}

ll powM(ll a, ll b, ll m) {
  if (b < 0 || a <= 0)return 0;
  a %= m;
  ll ans = 1LL;
  while (b) {
    if (b & 1)ans = ans * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return ans;
}

ll poww(ll a, ll b) {
  if (b < 0 || a <= 0)return 0;
  ll ans = 1LL;
  while (b) {
    if (b & 1)ans = ans * a;
    a = a * a;
    b >>= 1;
  }
  return ans;
}

const ll N = 3e5 + 5;

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


//ll allowed[105][105][105];


int main() {

  IOS;

#ifndef ONLINE_JUDGE

  freopen("input1.txt", "r", stdin);
  freopen("output1.txt", "w", stdout);

#endif



  ll n, x;
  cin >> n >> x;
  vl a(n + 1);
  FOR(i, 1, n) {
    cin >> a[i];
  }

  /*



  let us say we choose q elements.

  x%q == (sum)%q;

  so basically what is the max sum from q elements

  st sum%q==x%q;

  dp[i][j][mod]. (sum%q==mod)  mod:[0,q-1];

  dp[i-1][j][mod],dp[i-1][j-1][(mod-a[i]%q)]+a[i]

  and last me dp[n][q][x%q]  (for a fixed q).

  so ans=(x-dp)/q;




  */

  ll ans = x;

  FOR(q, 1, n) {
    vector<vvl>dp(n + 1, vvl(n + 1, vl(n + 1, -1e18)));

    dp[0][0][0] = 0;

    for (ll i = 0; i < n; i++) {
      for (ll j = 0; j <= i; j++) {
        for (ll mod = 0; mod < q; mod++) {
          chmax(dp[i + 1][j][mod], dp[i][j][mod]);
          chmax(dp[i + 1][j + 1][(mod + a[i + 1]) % q], dp[i][j][mod] + a[i + 1]);
        }
      }
    }

    ll blah = x % q;
    //d2(q, dp[n][q][blah]);
    if (dp[n][q][blah] > 0) chmin(ans, (x - dp[n][q][blah]) / q);
  }
  cout << ans << endl;




  return 0;
}
#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);
}
