/* -*- coding: utf-8 -*- * * 2210.cc: No.2210 equence Squence Seuence - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ /* global variables */ int as[MAX_N], xs[MAX_N]; /* subroutines */ /* main */ int main() { int n, k; scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) scanf("%d", as + i); k--; int r = -1; for (int i = 0, c = 1; r < 0 && i + 1 < n; i++) { if (as[i] < as[i + 1]) { if (k >= n - i - c) r = i; c = 1; } else if (as[i] > as[i + 1]) { if (k < c) r = i; k -= c; c = 1; } else { c++; } } for (int i = 0, j = 0; i < n; i++) if (i != r) xs[j++] = as[i]; for (int i = 0; i < n - 1; i++) printf("%d%c", xs[i], (i + 2 < n) ? ' ' : '\n'); return 0; }