#line 1 "F.cpp"
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n, t; scanf("%d%d", &n, &t);
	std::vector<int> a(n); for(auto& v: a) scanf("%d", &v);

	int A = n / 2, B = n - n / 2;

	std::vector<i64> X, Y;
	for(int i = 0; i < (1 << A); i++) {
		i64 sum = 0;
		for(int j = 0; j < A; j++) if(i >> j & 1) sum += a[j];
		X.push_back(sum);
	}
	for(int i = 0; i < (1 << B); i++) {
		i64 sum = 0;
		for(int j = 0; j < B; j++) if(i >> j & 1) sum += a[j + A];
		Y.push_back(sum);
	}
	sort(begin(X), end(X));
	sort(begin(Y), end(Y));

	i64 ans = 0;
	int cur = Y.size() - 1;
	for(int i = 0; i < X.size(); i++) {
		while(cur >= 0 and X[i] + Y[cur] > t) cur--;
		if(cur != -1) ans = std::max(ans, X[i] + Y[cur]);
	}
	assert(ans <= t);

	printf("%lld\n", ans);
	return 0;
}

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//#include <atcoder/convolution>
//#include <atcoder/modint> 
//using Modint = atcoder::modint998244353;

using namespace std;
typedef long long ll;

void ex_gcd(ll a, ll b, ll &d, ll &x, ll &y) {
  if (!b) {
    d = a;
    x = 1;
    y = 0;
  } else {
    ex_gcd(b, a % b, d, y, x);
    y -= a / b * x;
  }
}
ll inv(ll a, ll n) {
  ll d, x, y;
  ex_gcd(a, n, d, x, y);
  return d == 1 ? (x % n + n) % (n / d) : -1;
}
ll gcd(ll x, ll y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}

const int maxn = 1000005;
const int mod = 998244353;

vector<int>prim;
bool b[maxn];
void init(){
  for(int i=2;i<maxn;i++){
    if(!b[i]){
      prim.push_back(i);
      for(int j=i+i;j<maxn;j+=i)b[j]=1;
    }
  }
}

vector<int>p,c;
void dfs(int pos, int cur, int cnt, int l, int r, int& sum){
  if(cur>r)return;
  if(pos==p.size()){
    if(cnt==0)return;
    int tt = r/cur-(l-1)/cur;
    if(cnt&1)sum += tt;
    else sum -= tt;
    return;
  }
  dfs(pos+1, cur * p[pos], cnt+1, l,r,sum);
  dfs(pos+1, cur, cnt, l, r, sum);
}
void dfs2(int pos, int cur, int l, int r, int&sum){
  if(cur>r)return;
  if(pos==p.size()){
    if(cur>=l&&cur<=r)sum++;
    return;
  }
  int tt = 1;
  for(int i=0;i<=c[pos];i++){
    dfs2(pos+1, cur*tt, l,r,sum);
    tt*=p[pos];
  }
}
int solve(int l, int x) {
  if(l>=x)return 0;
  p.clear();
  c.clear();
  int cur = x;
  for(int i=0;prim[i]*prim[i]<=cur;i++){
    int tt = prim[i];
    if(cur%tt==0){
      int cnt = 0;
      while(cur%tt==0){
        cur/=tt;
        cnt++;
      }
      p.push_back(tt);
      c.push_back(cnt);
    }
  }
  if(cur>1){
    p.push_back(cur);
    c.push_back(1);
  }
  int sum = 0;
  dfs(0,1,0,l,x-1,sum);
  int sum2=0;
  dfs2(0,1,l,x-1,sum2);
  return sum-sum2;
}

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  init();
  int l,r;
  cin>>l>>r;
  ll ret = 0;
  for(int i=l+1;i<=r;i++){
    ret += solve(max(2, l), i);
  }
  cout<<ret*2<<endl;
  return 0;
}