#include <stdio.h>
FILE *fin,*fout;
struct nod { long a,b,c,val;
nod *urm;
};
nod *hash[500009];
struct trip {long a,b,c,val; };
trip sums[1000000];
long n,a[101],s,k,nr,x,y,z,i,p,o;
void add(long i,long val,long a,long b,long c)
{ if (hash[i]==NULL)
{ hash[i]=new nod;
hash[i]->urm=NULL;
hash[i]->val=val;
hash[i]->a=a;
hash[i]->b=b;
hash[i]->c=c;
}
else
{ nod *nw=new nod;
nw->urm=hash[i];
nw->val=val;
nw->a=a;
nw->b=b;
nw->c=c;
hash[i]=nw;
}
}
int find(long val,long &a,long &b,long &c)
{ long long i=val%500009;
nod *p=hash[i];
int found=0;
while (p->urm!=NULL)
{ if (p->val==val)
{ found=1;
break;
}
p=p->urm;
}
if (p->val==val)
found=1;
if (found==1)
{ a=p->a;
b=p->b;
c=p->c;
}
return found;
}
int main()
{
fin=fopen("loto.in","rt");
fout=fopen("loto.out","wt");
fscanf(fin,"%lld %lld",&n,&s);
for (i=0;i<n;i++)
fscanf(fin,"%lld",&a[i]);
for (i=0;i<n;i++)
for (p=0;p<n;p++)
for (o=0;o<n;o++)
{ sums[k].a=a[i];
sums[k].b=a[p];
sums[k].c=a[o];
sums[k].val=a[i]+a[p]+a[o];
add((a[i]+a[p]+a[o])%500009,a[i]+a[p]+a[o],a[i],a[p],a[o]);
k++;
}
for (i=0;i<k;i++)
if (find(s-sums[i].val,x,y,z))
{ fprintf(fout,"%ld %ld %ld %ld %ld %ld\n",sums[i].a,sums[i].b,sums[i].c,x,y,z);
return 0;
}
fprintf(fout,"-1\n");
return 0;
}