def select_num(nums,k): stack=[0]*len(nums); top=-1; cnt=len(nums)-k for num in nums: while cnt>0 and top!=-1 and stack[top]<num: top-=1; cnt-=1 top+=1; _______(1)__________ while cnt>0: top-=1; cnt-=1 return stack[0:top+1] def merge(a,b): c=''; i=0; j=0 while ______(2)_________: if j==len(b) or i<len(a) and a[i]>=b[j]: c+=str(a[i]); i+=1 elif i==len(a) or j<len(b) and a[i]<b[j]: c+=str(b[j]); j+=1 return int(c) n,m=map(int,input().split()) num1=list(map(int,input().split())) num2=list(map(int,input().split())) k=int(input()) _______(3)________ for i in range(1,k): a=select_num(num1,i) ______(4)_________ c=merge(a,b) if c>m: m=c print(m)