#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
static char buf[1048576];
static int s = 1048576;
static int e = 1048576;
if(s == e && e == 1048576){
e = fread_unlocked(buf, 1, 1048576, stdin);
s = 0;
}
if(s == e){
return EOF;
}
return buf[s++];
}
inline void rd(int &x){
int k;
int m=0;
x=0;
for(;;){
k = my_getchar_unlocked();
if(k=='-'){
m=1;
break;
}
if('0'<=k&&k<='9'){
x=k-'0';
break;
}
}
for(;;){
k = my_getchar_unlocked();
if(k<'0'||k>'9'){
break;
}
x=x*10+k-'0';
}
if(m){
x=-x;
}
}
inline void rd(long long &x){
int k;
int m=0;
x=0;
for(;;){
k = my_getchar_unlocked();
if(k=='-'){
m=1;
break;
}
if('0'<=k&&k<='9'){
x=k-'0';
break;
}
}
for(;;){
k = my_getchar_unlocked();
if(k<'0'||k>'9'){
break;
}
x=x*10+k-'0';
}
if(m){
x=-x;
}
}
inline long long rd_ll(void){
long long x;
rd(x);
return x;
}
struct MY_WRITER{
char buf[1048576];
int s;
int e;
MY_WRITER(){
s = 0;
e = 1048576;
}
~MY_WRITER(){
if(s){
fwrite_unlocked(buf, 1, s, stdout);
}
}
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
MY_WRITER_VAR.s = 0;
}
MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
my_putchar_unlocked(a);
}
inline void wt_L(long long x){
int s=0;
int m=0;
char f[20];
if(x<0){
m=1;
x=-x;
}
while(x){
f[s++]=x%10;
x/=10;
}
if(!s){
f[s++]=0;
}
if(m){
my_putchar_unlocked('-');
}
while(s--){
my_putchar_unlocked(f[s]+'0');
}
}
template<class T> inline T popFirst(multiset<T> &a){
T res = *(a.begin());
a.erase(a.begin());
return res;
}
template<class T> inline T getFirst(multiset<T> &a){
return *(a.begin());
}
template<class T> inline T popLast(multiset<T> &a){
T res;
typename multiset<T>::iterator it;
it = a.end();
it--;
res = *it;
a.erase(it);
return res;
}
template<class T> inline T getLast(multiset<T> &a){
typename multiset<T>::iterator it;
it = a.end();
it--;
return *it;
}
template<class T> inline T popFirst(set<T> &a){
T res = *(a.begin());
a.erase(a.begin());
return res;
}
template<class T> inline T getFirst(set<T> &a){
return *(a.begin());
}
template<class T> inline T popLast(set<T> &a){
T res;
typename set<T>::iterator it;
it = a.end();
it--;
res = *it;
a.erase(it);
return res;
}
template<class T> inline T getLast(set<T> &a){
typename set<T>::iterator it;
it = a.end();
it--;
return *it;
}
int N;
int K;
int R;
int A;
multiset<long long> a;
multiset<long long> b;
long long s;
long long t;
long long u;
int ress;
long long res[200000];
int main(){
int FmcKpFmN, Lj4PdHRW, e98WHCEY;
rd(N);
rd(K);
rd(R);
for(Lj4PdHRW=(0);Lj4PdHRW<(K);Lj4PdHRW++){
rd(A);
a.insert(A);
s += A;
}
for(e98WHCEY=(0);e98WHCEY<(N-K);e98WHCEY++){
b.insert(rd_ll());
}
for(FmcKpFmN=(0);FmcKpFmN<(R);FmcKpFmN++){
t = s;
s -= popFirst(a);
a.insert(t);
s += t;
if(b.size() && getLast(a) > getFirst(b)){
t = popLast(a);
u = popFirst(b);
a.insert(u);
b.insert(t);
s += u - t;
}
}
for(long long x : a){
res[ress++] = x;
}
for(long long x : b){
res[ress++] = x;
}
{
int a2conNHc;
if(ress==0){
wt_L('\n');
}
else{
for(a2conNHc=(0);a2conNHc<(ress-1);a2conNHc++){
wt_L(res[a2conNHc]);
wt_L(' ');
}
wt_L(res[a2conNHc]);
wt_L('\n');
}
}
return 0;
}
// cLay varsion 20201031-1
// --- original code ---
// int N, K, R, A;
// multiset<ll> a, b;
// ll s, t, u;
// int ress; ll res[2d5];
// {
// rd(N,K,R);
// rep(K){
// rd(A);
// a.insert(A);
// s += A;
// }
// rep(N-K) b.insert(rd_ll());
//
// rep(R){
// t = s;
// s -= popFirst(a);
//
// a.insert(t);
// s += t;
//
// if(b.size() && getLast(a) > getFirst(b)){
// t = popLast(a);
// u = popFirst(b);
// a.insert(u);
// b.insert(t);
// s += u - t;
// }
// }
//
// for(ll x : a) res[ress++] = x;
// for(ll x : b) res[ress++] = x;
// wt(res(ress));
// }