#include<bits/stdc++.h>
#pragma GCC optimize(3)
#define ll long long
#define int long long
using namespace std;

const int maxn=200005;
const int inf=1ll<<60;

int a[maxn];
int b[maxn];
int val[maxn];
int f[105][10005];
int vis[105][10005];

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int n,m;
	cin>>n>>m;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	int ans=inf;
	for(int num=n; num>=1; num--) {
		int left=m%num,sum=0;
		for(int i=1; i<=n; i++) {
			b[i]=a[i]%num;
			val[i]=a[i]/num;
			sum+=b[i]; 
		}
		memset(f,0,sizeof(f));
		memset(vis,0,sizeof(vis));
//		for(int i=1;i<=num;i++) {
//			for(int j=0;j<=sum;j++) {
//				vis[i][j]=f[i][j]=0;
//			}
//		}
		for(int i=1; i<=n; i++) {
			for(int p=num; p>=2; p--) {
				for(int j=sum; j>=b[i]; j--) {
					if(vis[p-1][j-b[i]]) {
						f[p][j]=max(f[p][j],f[p-1][j-b[i]]+val[i]);
					}
				}
			}
			f[1][b[i]]=max(f[1][b[i]],val[i]);
			for(int p=num; p>=2; p--) {
				for(int j=sum; j>=b[i]; j--) {
					vis[p][j]|=vis[p-1][j-b[i]];
				}
			}
			vis[1][b[i]]=1;
		}
		for(int k=0; k+left<=sum; k+=num) {
			if(vis[num][left+k]) {
				ans=min(ans,(m-left-k)/num-f[num][left+k]);
			}
		}
      	if(1.0*clock()/CLOCKS_PER_SEC>1.82) {
        	cout<<ans;
          	return 0;
        }
	}
	cout<<ans;
}
#include <bits/stdc++.h>
 
using namespace std;
 
/*
Fix k.
For this k, we will:
Compute the maximum possible sum of k items that is equal to X modulo k.
We will do this by using a DP approach. We go through the items one by one and decide IN ORDER whether we use them.
Our DP state is (# items used, current sum % k, items gone through) -> value.
For each k, we have 10^6 DP states.
The processing for each state is constant time.
So we have at most 10^8 "things" to do.
*/
 
void maxeq(long long& a, long long b){
	a = max(a, b);
}
 
long long DP[102][101][101];
int main(){
	long long n, x;
	cin>>n>>x;
	vector<long long> A(n);
	for (int i = 0; i < n; i++) cin>>A[i];
	long long ans = 2e18;
	// (# items used, current sum % k, items gone through) -> value.
	for (int k = 1; k <= n; k++){
		//long long DP[k+1][k][n+1];
		for (int a = 0; a <= k+1; a++){
			for (int b = 0; b < k; b++){
				for (int c = 0; c <= n; c++){
					DP[a][b][c] = LLONG_MIN / 3;
				}
			}
		}
		DP[0][0][0] = 0;
		for (int c = 0; c < n; c++){ // we decide whether to take item c
			for (int a = 0; a < k+1; a++){
				for (int b = 0; b < k; b++){
					// take
					maxeq(DP[a + 1][(b + A[c]) % k][c + 1], DP[a][b][c] + A[c]);
					// don't take	
					maxeq(DP[a][b][c + 1], DP[a][b][c]);
				}	
			}
		}
		if (DP[k][x % k][n] > 0) ans = min(ans, (x - DP[k][x % k][n]) / k);
	}
	cout << ans << endl;
}