#include #include #include using namespace std; int main(){ int n, k; cin >> n >> k; vector a(n); for(auto &it: a) cin >> it; vector u(n); for(int i = 0; i < n;){ int j = i; while(j+1 < n && a[j] == a[j+1]) j++; bool res = true; if(j+1 < n) res = a[j] < a[j+1]; for(int l = i; l <= j && l < n; l++) u[l] = res; i = j+1; } vector v(n); for(int i = 0; i < n; i++) v[i] = i; sort(v.begin(), v.end(), [&](int x, int y){ return u[min(x, y)]; }); vector ans; for(int i = 0; i < n; i++){ if(v[k-1] == i) continue; ans.emplace_back(a[i]); } for(int i = 0; i < ans.size(); i++) cout << ans[i] << " \n"[i == ans.size()-1]; return 0; }