#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int maxS = 41;
int arr[maxS];
vector<long long>A[2];




void rec(int currentPos,int size,int idx,long long sum){
	if(currentPos > size){
		A[idx].push_back(sum);
		return ;
	}
	rec(currentPos + 1,size,idx,sum + arr[currentPos]);
	rec(currentPos + 1,size,idx,sum);
}

void tc(){
	int N , T;
	cin >> N >> T;
	for(int i = 1 ; i <= N ;i ++){
		cin >> arr[i];
	}
	rec(1,N/2,0,0);
	rec((N/2)+1,N,1,0);
	sort(A[1].begin(),A[1].end());
	long long MAX = 0;
	for(int i = 0 ; i < (int)A[0].size(); i ++){
		long long TEMP = A[0][i];
		long long REM = T - TEMP;
		if(REM > 0){
			auto itr = lower_bound(A[1].begin(),A[1].end(),REM);
			if(itr==A[1].begin()&&*itr!=REM)
				continue;
			if(itr==A[1].end())
				--itr;
			else{
				if(*itr!=REM)
					--itr;
			}
			MAX = max(MAX , *itr + TEMP);
		}
		}
		cout << MAX << "\n";
	}

int main(){
		ios_base::sync_with_stdio(false);
		cin.tie(0);
		cout.tie(0);
		int t;
		t = 1;
		//cin >> t;
		while(t--){
			tc();
		}
	
}

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

int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71}, lst[75];
long long A,B, dp[2][1<<20];

int main() {
    scanf("%lld %lld", &A, &B);
    for (int i = 0; i <= B-A; ++i) {
        lst[i] = 0;
        for (int j = 0; j < 20; ++j) if ((A+i) % primes[j] == 0) lst[i] |= (1<<j);
    }
    for (int i = 0; i < (1<<20); ++i) dp[1-(B-A)%2][i] = 1;
    for (int i = B-A; i >= 0; --i) for (int j = 0; j < (1<<20); ++j) {
        dp[i%2][j] = dp[1-i%2][j];
        if ((lst[i] & j) == 0) dp[i%2][j] += dp[1-i%2][j|lst[i]];
    }
    printf("%lld", dp[0][0]);

    return 0;
}
