#include<bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
using namespace std;
#define int long long
#define fi first
#define se second
#define y1 cheza
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N=2e5+1000;
const int M=1e4;
const int mod=1e9+7;
const int INF=1e18;
const int dx[]={1,-1,0,0};
const int dy[]={0,0,-1,1};
const long double eps=1e-6;
int n, k, pre[N], nex[N], pos[N];
set <pair <int, pair <int, int>>> s;
map <int, int> mp;
void test(){
    cin >> n >> k;
    s.insert ({-n, {0, n + 1}});
    int id = 0;
    mp[0] = 0, mp[n + 1] = k + 1;
    pos[k + 1] = n + 1;
    for (int i = 1; i <= k; i++) {
        char type;
        cin >> type;
        if (type == '-') {
            int x;
            cin >> x;
            int l = pre[x], r = nex[x];
            s.erase ({-(pos[x] - pos[l] - 1), {pos[l], pos[x]}});
            s.erase ({-(pos[r] - pos[l] - 1), {pos[x], pos[r]}});
            s.insert ({-(pos[r] - pos[l] - 1), {pos[l], pos[r]}});
            pre[r] = l;
            nex[l] = r;
        }
        else {
            id++;
            int l = (*s.begin ()).se.fi, r = (*s.begin ()).se.se;
            if (l == 0) pos[id] = 1;
            else if (r == n + 1) pos[id] = n;
            else pos[id] = l + -(*s.begin ()).fi / 2 + (-(*s.begin ()).fi) % 2;
            cout << pos[id] << "\n";
            mp[pos[id]] = id;
            nex[mp[l]] = pre[mp[r]] = id;
            pre[id] = mp[l], nex[id] = mp[r];
            s.erase (s.begin ());
            s.insert ({-(pos[id] - l - 1), {l, pos[id]}});
            s.insert ({-(r - pos[id] - 1), {pos[id], r}});
        }
    }
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout.tie(nullptr);
    long long t2=1;
    for(int i=1;i<=t2;i++){
        test();
    }
    
    return 0;

}
/*
temmie luck

*/
