#include<bits/stdc++.h>
#define ll long long
#define mll map<ll,ll>
#define u_mll unordered_map<ll,ll>
#define pll pair<ll,ll>
#define sll set<ll>
#define msll multiset<ll>
#define usll unordered_set<ll>
#define vll vector<ll>
#define vv vector
#define pqll priority_queue<ll, vll, greater<ll> ()>
#define pql priority_queue<ll>
#define MAX 19999999
#define ff first
#define ss second
#define pb push_back
#define srt(s) sort(s.begin(), s.end())
#define srtr(rs) sort(s.rbegin(), s.rend())
#define f(i,a,n) for(ll i = a; i < n; i++)
#define f1(i,a,n) for(ll i = a; i <= n; i++)
#define fr(i,a,n) for(ll i = n; i > a; i--)
#define abc int main
#define close_kor_taratari return 0
#define endl "\n"
#define testcase ll t; cin>>t; while(t--)
using namespace std;
 
bool isprime(ll n) {
    if(n < 2) return false;
    for(ll i = 2; i * i <= n; i++) {
        if(n % i == 0) 
        {
            return false;
        }
    }
    return true;
}
 
bool perfect_sqr(ll n) {
    ll a = sqrt(n);
    return (a * a == n);
}
 
bool isfibo(ll n) {
    return perfect_sqr(5*n*n + 4) or perfect_sqr(5*n*n - 4);
}
bool Max(ll a, ll b) {
    return a > b;
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll m, h;
  cin>>m>>h;
  if(h % m == 0) {
    cout<<"Yes";
  }
  else {
    cout<<"No";
  }
}
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) ((x).begin()), ((x).end())

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

vector<ll> calc_all_sums(vector<ll> &v) {
  vector<ll> retv;
  int N = v.size();
  for (ull bits = 0; bits < (1ULL << N); bits++) {
    ll sum = 0;
    for (size_t i = 0; i < N; i++) {
      if ((bits & (1ULL << i)) != 0) {
        sum += v[i];
      }
    }

    retv.push_back(sum);
  }

  sort(ALL(retv));
  retv.erase(unique(ALL(retv)), retv.end());
  return retv;
}

ll solve(int N, ll T, vector<ll> &A) {
  int mid_N = N / 2;

  vector<ll> left_A{A.begin(), A.begin() + mid_N};
  vector<ll> right_A{A.begin() + mid_N, A.end()};

  vector<ll> left_sums = calc_all_sums(left_A);
  vector<ll> right_sums = calc_all_sums(right_A);

  ll retv = 0;
  for (auto &&l_sum : left_sums) {
    ll max_r_sum = T - l_sum;
    auto r_upper_itr = upper_bound(ALL(right_sums), max_r_sum);
    ll r_sum = (r_upper_itr != right_sums.begin() ? *(r_upper_itr - 1) : 0);
    ll sum = l_sum + r_sum;
    sum = (sum <= T ? sum : 0);
    retv = max(retv, sum);
  }

  return retv;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  int N;
  ll T;
  cin >> N >> T;

  vector<ll> A(N, 0);
  for (size_t i = 0; i < N; i++) {
    cin >> A[i];
  }

  // main procedure
  ll ans = solve(N, T, A);

  // output
  cout << ans << endl;

  return 0;
}