#include <bits/stdc++.h>
using namespace std;
#define int long long int
const double pi = 3.14159265358979;
const int inf = 1e13;
#define pii pair<int,int>
#define endl "\n"
#define dtor(deg) (((deg)/360)*2*pi)
#define all(a) a.begin(),a.end()
#define overload(_1,_2,_3,_4,name,...) name
#define _rep1(n) for(int i = 0; i < (n); i++)
#define _rep2(i,n) for(int i = 0; i < (n); i++)
#define _rep3(i,a,b) for(int i = (a); i < (b); i++)
#define _rep4(i,a,b,c) for(int i = (a); i < (b); i += (c))
#define rep(...) overload(__VA_ARGS__,_rep4,_rep3,_rep2,_rep1)(__VA_ARGS__)
#define _rrep1(n) for(int i = (n) - 1; i >= 0; i--)
#define _rrep2(i,n) for(int i = (n) - 1; i >= 0; i--)
#define _rrep3(i,a,b) for(int i = (b) - 1; i >= (a); i--)
#define rrep(...) overload(__VA_ARGS__,_null,_rrep3,_rrep2,_rrep1)(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define vv(type,name,size,...) vector<vector<type>> name(size,vector<type>(__VA_ARGS__))
#define ForEach(a,b) for_each(a.begin(),a.end(),b)
struct Edge { int to, cost; Edge(int to, int cost) : to(to), cost(cost) {} };
using Graph = vector<vector<Edge>>;
template <class T> bool chmin(T& a, T b){ if(a > b){ a = b; return 1; } return 0; }
template <class T> bool chmax(T& a, T b){ if(a < b){ a = b; return 1; } return 0; }

void Main(){
    int n, t, ans = 0;
    cin >> n >> t;
    vector<int> a, b, sum_a, sum_b;
    rep(n){
        int input;
        cin >> input;
        if(i % 2) a.push_back(input);
        else b.push_back(input);
    }
    rep(bit, 1 << a.size()){
        int temp = 0;
        rep(a.size()) if(bit >> i & 1) temp += a[i];
        sum_a.push_back(temp);
    }
    rep(bit, 1 << b.size()){
        int temp = 0;
        rep(b.size()) if(bit >> i & 1) temp += b[i];
        sum_b.push_back(temp);
    }
    sort(all(sum_a));
    for(auto x : sum_b){
        int temp = t - x;
        int ind = upper_bound(all(sum_a), temp) - sum_a.begin() - 1;
        if(ind == -1) continue;
        chmax(ans, sum_a[ind] + x);
    }
    cout << ans << endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(10) << fixed;
    //int n; cin >> n; rep(n)
    Main();
}
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string>
#include<map>

#define rep(i,n)  for(int i=0;i<(n);i++)

bool is_prime(int x){
if(x<=1) return false;
for(int i=2;i*i<x;i++){
    if(x%i==0) return false;}
return true;}

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

using namespace std;
int main(){
    int n;
    cin>>n;

    double x[n],y[n];
    rep(i,n) cin>>x[i]>>y[i];
    int ans=0;

    rep(i,n)rep(j,n){
        if(i==j)continue;

        if((y[i]-y[j])/(x[i]-x[j])>=-1 and (y[i]-y[j])/(x[i]-x[j])<=1){
          ans++;
        }
    }

    cout << ans/2 << endl;






}