#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <cmath>
#define N 400005
#define INF 0x6f6f6f6f
#define debug(a)
cout<<#a<<' '<<a<<endl;
typedef long long LL;
using namespace std;
struct node{int a,b,f;
node (int x,int y,int z)
{
a=x,b=y,f=z;
}
node()
{}friend bool operator<(node x,node y)
{
if(x.a+x.b==y.a+y.b)
return x.a>y.a;
else
return x.a+x.b>y.a+y.b;
}
};
int a[N],b[N];
int n,m;
int ans[N];
int main()
{
#ifndef ONLINE_JUDGEfreopen("in.txt","r",stdin);
#endif
while(scanf("%d %d",&n,&m)!=EOF)
{
priority_queue<node> q;
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
for(int i=1;i<=n;i++)
scanf("%d",&b[i]);
sort(a+1,a+1+n);
sort(b+1,b+1+n);
int l=0;
for(int i=1;i<=n;i++)
{
q.push(node(a[i],b[1],1));
}
node tmp;
while(l<m)
{
tmp=q.top();
q.pop();
ans[l++]=tmp.a+tmp.b;
tmp.b=b[++tmp.f];
q.push(tmp);
}
for(int i=0;i<l;i++)
printf("%d\n",ans[i]);
}
return 0;
}