# include <bits/stdc++.h>

# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define all(x) (x).begin(), (x).end()
# define deb(x) cerr << #x  << " = " << x << endl; 
# define pll pair <ll, ll>
# define pii pair <int, int>
# define int ll

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const ll maxn = 2e5 + 7;
const ll inf = 2e18 + 0;
const ll mod = 1e9 + 7;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

set<pair<ll,pair<ll,ll>>> orta , sheti;
set<pair<ll,ll>> ob;
ll n , k , a[maxn];
void add(int l , int r){
	if(r < l) return;
	if(l == 1 || r == n){
		sheti.insert({r-l,{-l,-r}});
	} else {
		orta.insert({(r-l)/2,{-l,-r}});
	}
	ob.insert({r,l});
}
void ma1n () {
    cin >> n >> k;
    sheti.insert({n-1,{-1,-n}});
    ob.insert({n,1});
    int sz = 0 , i = 0;
    while(k--){
    	i++;
    	// cout << i <<" ";
    	string s;
    	cin >> s;
    	if(s == "+"){
    		sz++;
    		if(orta.size() > 0 && sheti.size() > 0){
    			int len = orta.rbegin()->ff;
    			int l = -orta.rbegin()->ss.ff;
    			int r = -orta.rbegin()->ss.ss;
    			int len2 = sheti.rbegin()->ff;
    			int l2 = -sheti.rbegin()->ss.ff;
    			int r2 = -sheti.rbegin()->ss.ss;
    			if(len2 == len){
    				int md = (l+r) >> 1;
    				if(l2 == 1){
    					a[sz] = l2;
    					sheti.erase({len2,{-l2,-r2}});
    					ob.erase({r2,l2});
    					add(l2+1,r2);
     				} else {
    					a[sz] = md;
    					ob.erase({r,l});
    					orta.erase({len,{-l,-r}});
    					add(l,md-1);
    					add(md+1,r);
    				}
    			} else if(len2 > len){
					if(l2 == 1){
						a[sz] = l2;
						add(l2+1,r2);
					} else {
						a[sz] = r2;
						add(l2,r2-1);
					}
					ob.erase({r2,l2});
					sheti.erase({len2,{-l2,-r2}});
    			} else {
    				int md = (l+r) >> 1;
    				a[sz] = md;
    				add(l,md-1);
    				add(md+1,r);
    				ob.erase({r,l});
    				orta.erase({len,{-l,-r}});
    			}
    		} else if(sheti.size() > 0){
    			int len2 = sheti.rbegin()->ff;
    			int l2 = -sheti.rbegin()->ss.ff;
    			int r2 = -sheti.rbegin()->ss.ss;
    			if(l2 == 1){
					a[sz] = l2;
    				add(l2+1,r2);
				} else {
					a[sz] = r2;
    				add(l2,r2-1);
				}
				ob.erase({r2,l2});
				sheti.erase({len2,{-l2,-r2}});
    		} else {
    			int len = orta.rbegin()->ff;
    			int l = -orta.rbegin()->ss.ff;
    			int r = -orta.rbegin()->ss.ss;
    			int md = (l+r) >> 1;
				a[sz] = md;
				add(l,md-1);
				add(md+1,r);
				ob.erase({r,l});
				orta.erase({len,{-l,-r}});	
    		}
    		cout <<  a[sz] << endl;
    	} else {
    		ll x = 0;
    		for(int j = 1; j < s.size(); j++){
    			x *= 10;
    			x += (s[j]-'0');
    		}
    		ll pos = a[x] , R = pos , L = pos;	 
    		auto it = ob.lower_bound({pos,0});
    		if(it != ob.end()){
    			pair<ll,ll> bol = *it;
    			int r = bol.ff;
    			int l = bol.ss;
    			if(l == pos+1) {
    				R = r;
    				if(r == n){
    					int len = r-l;
    					sheti.erase({len,{-l,-r}});
    				} else {
    					int len = (r-l)/2;
    					orta.erase({len,{-l,-r}});
    				}
    			}
    			
    		}
    		if(it != ob.begin()){
    			it--;
    			pair<ll,ll> bol = *it;
    			int r = bol.ff;
    			int l = bol.ss;
    			if(r == pos-1) {
  					L = l; 
    				if(l == 1){
    					int len = r-l;
    					sheti.erase({len,{-l,-r}});
    				} else {
    					int len = (r-l)/2;
    					orta.erase({len,{-l,-r}});
    				}
    			}

    		}
    		if(pos-1 >= L) ob.erase({pos-1,L});
    		if(R >= pos+1) ob.erase({R,pos+1});
    		add(L,R);
    		// cout << pos <<" " << L <<" " << R << endl;
    	}
    }
}
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//  freopen("file.in", "r", stdin);
//  freopen("file.out", "w", stdout);
    int ttt = 1;
//  cin >> ttt;
    for (int test = 1; test <= ttt; ++test) {
//      cout << "Case " << test << ":" << '\n';
        ma1n();
    }
    return 0;
}
