var x1,y1,x2,y2,area,ans:array[1..50]of longint;
n,k,now,i,j:longint;
procedure swap(var a,b:longint);
var t:longint;
begin
t:=a; a:=b; b:=t;
end;
procedure cal(l,r,b,t,z:longint);
begin
while (z<=n) and ((r<=x1[z]) or (l>=x2[z]) or (t<=y1[z]) or (b>=y2[z])) do inc(z);
if z>n then begin inc(area[now],(r-l)*(t-b));exit;end;
if l<x1[z] then begin cal(l,x1[z],b,t,z+1);l:=x1[z];end;
if r>x2[z] then begin cal(x2[z],r,b,t,z+1);r:=x2[z];end;
if b<y1[z] then cal(l,r,b,y1[z],z+1);
if t>y2[z] then cal(l,r,y2[z],t,z+1);
end;
begin
readln(n,k);
for i:=1 to n do read(x1[i]); readln;
for i:=1 to n do read(y1[i]); readln;
for i:=1 to n do read(x2[i]); readln;
for i:=1 to n do read(y2[i]); readln;
for i:=n downto 1 do begin
ans[i]:=i;
now:=i;
cal(x1[now],x2[now],y1[now],y2[now],i+1);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if (area[i]<area[j])or((area[i]=area[j])and(ans[i]>ans[j]))
then begin swap(area[i],area[j]); swap(ans[i],ans[j]); end;
for i:=1 to k-1 do
for j:=i+1 to k do
if ans[i]>ans[j] then swap(ans[i],ans[j]);
for i:=1 to k-1 do write(ans[i]-1,' ');
writeln(ans[k]-1);
close(input);
close(output);
end.