/* ID: espr1t TASK: KEYWORDS: */ #include #include #include #include #include using namespace std; FILE *in; FILE *out; const int MAX = 1024; int n, m; int a[MAX]; int main(void) { in = stdin; out = stdout; in = fopen("add.in", "rt"); out = fopen("add.out", "wt"); fscanf(in, "%d %d", &n, &m); for (int i = 0; i < n; i++) fscanf(in, "%d", &a[i]); int cur = 0; for (int i = 0; i < n; i++) { for (int c = i + 1; c < n; c++) if (a[i] > a[c]) cur++; } int idx = 0; cur += n; vector ans; while (idx <= n) { if (cur == m) { for (int i = 0; i < n; i++) { if (idx == i) ans.push_back(n + 1); ans.push_back(a[i]); } if (idx == n) ans.push_back(n + 1); break; } idx++; cur--; } if ((int)ans.size() == 0) { fprintf(out, "Impossible\n"); } else { for (int i = 0; i < (int)ans.size(); i++) fprintf(out, "%d%c", ans[i], i + 1 == (int)ans.size() ? '\n' : ' '); } return 0; }