#include #define REP(i, n) for(int i = 0; i < (int)(n); i++) using namespace std; int main(){ int q, k; cin >> q >> k; vector S; int number; int buffer; REP(i, q) { cin >> number; if(number == 1) { cin >> buffer; S.push_back(buffer); } else if(number == 2) { if(S.size() < k) { cout << "-1\n"; } else { sort(S.begin(), S.end()); cout << S[k-1] << '\n'; S.erase(S.begin() + k-1); } } } }