#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

const int N = 1e5 + 5;
LL b[N];
int d[N];
int k, n, m;
int p[N];

bool cmp(int a, int c) {
    return b[a] % n > b[c] % n;
}

int main() {
    read(k), read(n), read(m);
    for (int i = 1; i <= k; ++i) {
        read(d[i]);
    }
    int tot = 0;
    for (int i = 1; i <= k; ++i) {
        b[i] = (LL)d[i] * m;
        p[i] = i;
        tot += b[i] / n;
    }
    sort(p + 1, p + k + 1, cmp);
    for (int i = 1; i <= k; ++i) {
        b[i] /= n;
    }
    for (int i = 1; i <= m - tot; ++i) {
        b[p[i]]++;
    }
    for (int i = 1; i <= k; ++i) {
        printf("%lld ", b[i]);
    }
    return 0;
}
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

int main(void) {
  ios::sync_with_stdio(false);
  int64_t N, T;
  cin >> N >> T;
  vector<int64_t> A(N);
  rep(i, N) { cin >> A[i]; }

  int64_t N0 = N / 2;
  int64_t N1 = N - N0;

  vector<int64_t> A0;
  rep(i, (1 << N0)) {
    int64_t sum = 0;
    rep(j, N0) {
      if (i & (1 << j)) {
        sum += A[j];
      }
    }
    if (sum <= T) A0.emplace_back(sum);
  }

  vector<int64_t> A1;
  rep(i, (1 << N1)) {
    int64_t sum = 0;
    rep(j, N1) {
      if (i & (1 << j)) {
        sum += A[N0 + j];
      }
    }
    if (sum <= T) A1.emplace_back(sum);
  }
  sort(A1.begin(), A1.end());

  int64_t answer = 0;
  for (auto a0 : A0) {
    int64_t need = T - a0;
    auto itr = lower_bound(A1.begin(), A1.end(), need);
    if (itr != A1.end() && *itr == need) {
      answer = T;
      break;
    }
    if (itr != A1.begin()) {
      answer = max(answer, a0 + *(--itr));
    }
  }
  cout << answer << endl;
  return 0;
}
