为什么会这样啊....
type node=record
n,p:longint;
end;
var n,k,i,be,en:longint;
d,c,e:array[0..1000000] of longint;
w:array[0..1000000] of node;
procedure qsort(l,r:longint);
var i,j:longint;si:node;
begin
i:=l;j:=r;si:=w[i];
while i<j do begin
while (i<j)and(si.n>w[j].n) do dec(j);
if i<j then begin w[i]:=w[j]; inc(i);end;
while (i<j)and(si.n<w[i].n) do inc(i);
if i<j then begin w[j]:=w[i]; dec(j);end;
end;
w[i]:=si;
if l<i-1 then qsort(l,i-1);
if i+1<r then qsort(i+1,r);
end;
procedure qsort2(l,r:longint);
var i,j:longint;si:node;
begin
i:=l;j:=r;si:=w[i];
while i<j do begin
while (i<j)and(si.p<w[j].p) do dec(j);
if i<j then begin w[i]:=w[j]; inc(i);end;
while (i<j)and(si.p>w[i].p) do inc(i);
if i<j then begin w[j]:=w[i]; dec(j);end;
end;
w[i]:=si;
if l<i-1 then qsort(l,i-1);
if i+1<r then qsort(i+1,r);
end;
begin
readln(n,k);
for i:=1 to 10 do read(e[i]);readln;
for i:=1 to n do begin
read(w[i].n);w[i].p:=i;
end;
readln;
qsort(1,n);
be:=1;en:=2;
while be<n do begin
while w[be].n=w[en].n do
inc(en);
dec(en);
qsort2(be,en);
be:=en+1;
en:=be+1;
end;
for i:=1 to n do
d[i]:=i;
for i:=1 to n do
c[i]:=(d[i]-1) mod 10 +1;
for i:=1 to n do
w[i].n:=w[i].n+e[c[i]];
qsort(1,n);
be:=1;en:=2;
while be<n do begin
while w[be].n=w[en].n do
inc(en);
dec(en);
qsort2(be,en);
be:=en+1;
en:=be+1;
end;
for i:=1 to k-1 do
write(w[i].p,' ');
writeln(w[k].p);
end.