#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
int main(){
tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> tr;
long long n,q,el=0;
cin >> n >> q;
while(q--){
long long t,v;
cin >> t >> v;
if(t==1){
tr.insert(v);
el++;
}
else{
long long st=v,fi=v+el,te;
while(st<=fi){
te=(st+fi)/2;
if((te-tr.order_of_key(te+1))<v){st=te+1;}
else{fi=te-1;}
}
cout << st << '\n';
}
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KI2luY2x1ZGUgPGV4dC9wYl9kcy90cmVlX3BvbGljeS5ocHA+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp1c2luZyBuYW1lc3BhY2UgX19nbnVfcGJkczsKCmludCBtYWluKCl7Cgl0cmVlPGxvbmcgbG9uZywgbnVsbF90eXBlLCBsZXNzPGxvbmcgbG9uZz4sIHJiX3RyZWVfdGFnLCB0cmVlX29yZGVyX3N0YXRpc3RpY3Nfbm9kZV91cGRhdGU+IHRyOwoJbG9uZyBsb25nIG4scSxlbD0wOwoJY2luID4+IG4gPj4gcTsKCXdoaWxlKHEtLSl7CgkJbG9uZyBsb25nIHQsdjsKCQljaW4gPj4gdCA+PiB2OwoJCWlmKHQ9PTEpewoJCQl0ci5pbnNlcnQodik7CgkJCWVsKys7CgkJfQoJCWVsc2V7CgkJCWxvbmcgbG9uZyBzdD12LGZpPXYrZWwsdGU7CgkJCXdoaWxlKHN0PD1maSl7CgkJCQl0ZT0oc3QrZmkpLzI7CgkJCQlpZigodGUtdHIub3JkZXJfb2Zfa2V5KHRlKzEpKTx2KXtzdD10ZSsxO30KCQkJCWVsc2V7Zmk9dGUtMTt9CgkJCX0KCQkJY291dCA8PCBzdCA8PCAnXG4nOwoJCX0KCX0KCXJldHVybiAwOwp9