#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <map>
using namespace std;
struct num
{
long long int s, x, y, z;
} aux;
int main()
{
map<long long int, struct num> h;
long long int i, j, k, s, n, a[100], max = 0;
freopen("loto.in", "r", stdin);
freopen("loto.out", "w", stdout);
scanf("%lld %lld", &n, &s);
for (i = 0; i < n; i++)
{
scanf("%lld", &a[i]);
if(a[i] > max)
{
max = a[i];
}
}
if(max*6 >= s)
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
for (k = 0; k < n; k++)
{
aux.s = a[i]+a[j]+a[k];
aux.x = a[i];
aux.y = a[j];
aux.z = a[k];
h[aux.s] = aux;
if(h[s-aux.s].s == s - aux.s)
{
printf("%lld %lld %lld %lld %lld %lld", a[i], a[j], a[k], h[s-aux.s].x, h[s-aux.s].y, h[s-aux.s].z);
goto label;
}
}
printf("-1");
label:
return 0;
}