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

const int MAX = 101;
int64_t dp[MAX][MAX][MAX];

void clean(int K){
  for(int i=0; i<MAX; i++){
    for(int j=0; j<MAX; j++){
      for(int k=0; k<K; k++){
        dp[i][j][k] = -1;
      }
    }
  }
}

int main(){
  int64_t N, X;
  cin >> N >> X;
  vector<int64_t> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
  }
  
  int64_t ans = 1e18;
  
  //使う数決めうち
  for(int i=1; i<=N; i++){
    clean(i);
    dp[0][0][0] = 0;
    dp[0][1][vec[0]%i] = vec[0];
    for(int j=1; j<N; j++){ //今から使うもの
      for(int k=0; k<=j; k++){ //何個使ったか？
        for(int l=0; l<i; l++){ //あまりは何か？
          if(dp[j-1][k][l] != -1){
            //cout << j-1 << " " << k << " " << l << " " << dp[j-1][k][l] << endl;
            //使う時
            dp[j][k+1][(l+vec[j])%i] = max(dp[j][k+1][(l+vec[j])%i], dp[j-1][k][l] + vec[j]);
            //使わない時
            dp[j][k][l] = max(dp[j][k][l],dp[j-1][k][l]);
          }
        }
      }
    }
    int64_t A = X % i;
    if(X %i == 0){
      A = 0;
    }
    if(dp[N-1][i][A] == -1){
      continue;
    }
    ans = min(ans, (X - dp[N-1][i][A])/i);
  }  
  cout << ans << endl;
}
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
const int N = 2e6;
using namespace std;
int n,a[N + 5],ans,lim,c[N + 5],cnt,t;
void dfs1(int x,int ti)
{
    if (ti > t)
        return;
    if (x == lim + 1)
    {
        c[++cnt] = ti;
        return;
    }
    dfs1(x + 1,ti + a[x]);
    dfs1(x + 1,ti);
}
void dfs2(int x,int ti)
{
    if (ti > t)
        return;
    if (x == n + 1)
    {
        int pos = upper_bound(c + 1,c + cnt + 1,t - ti) - c;
        pos--;
        if (pos <= 0)
            return;
        ans = max(ans,c[pos] + ti);
        return;
    }
    dfs2(x + 1,ti + a[x]);
    dfs2(x + 1,ti);
}
int main()
{
	scanf("%d%d",&n,&t);
    for (int i = 1;i <= n;i++)
        scanf("%d",&a[i]);
    lim = n / 2;
    dfs1(1,0);
    sort(c + 1,c + cnt + 1);
    dfs2(lim + 1,0);
    cout<<ans<<endl;
	return 0;
}
