1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
var m, n, i: int16; a: array of int32; b: int32; begin readln(m, n); setlength(a, m); for i := 0 to m - 1 do read(a[i]); i := 0; repeat read(b); while (i < m) and (a[i] <= b) do begin write(a[i], ' '); inc(i) end; write(b, ' '); dec(n) until n = 0; while i < m do begin write(a[i], ' '); inc(i) end; writeln end.