#include<bits/stdc++.h>
using namespace std;
const int NMAX = 105;
ifstream fin("loto1.in");
ofstream fout("loto1.out");
int v[NMAX];
typedef long long int ll;
struct Triplet {
int x, y, z;
};
unordered_map<ll, vector<Triplet>> f;
void read_input(int &n, ll &target_sum) {
fin >> n >> target_sum;
for (int i = 1; i <= n; i++) {
fin >> v[i];
}
}
void compute_sum_frequency(const int &n) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
int a = v[i];
int b = v[j];
int c = v[k];
f[(ll)(a + b + c)].push_back({a, b, c});
}
}
}
}
void compute_result(const int &n, const ll &target_sum) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
int a = v[i];
int b = v[j];
int c = v[k];
ll dif = target_sum - ((ll)(a + b + c));
if (f[dif].size() > 0) {
fout << a << ' ' << b << ' ' << c << ' ' << f[dif][0].x << ' ' << f[dif][0].y << ' ' << f[dif][0].x << ' ' << '\n';
return;
}
}
}
}
fout << "-1\n";
}
int main() {
int n;
ll target_sum;
read_input(n, target_sum);
compute_sum_frequency(n);
compute_result(n, target_sum);
return 0;
}