#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define ll long long
#define sz(s) (int)s.size()
#define in insert
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
#define pll pair<ll, ll>

struct node{
    node *l = nullptr, *r = nullptr;
    // ll sum=0;
    pll mx={-1, -1};
    node(){}
};

// void updsum(node *v, ll l, ll r, ll pos, ll x){
//     if(l == r){
//         v -> sum = x;
//         return;
//     }
//     int mid=(l+r)/2;
//     if(mid >= pos){
//         if(!(v -> l)){
//             v -> l = new node();
//             v -> l -> sum = 0;
//             v -> l -> mx = {-1, -1};
//         }
//         updsum(v -> l, l, mid, pos, x);
//     }
//     else{
//         if(!(v -> r)){
//             v -> r = new node();
//             v -> r -> sum = 0;
//             v -> r -> mx = {-1, -1};
//         }
//         updsum(v -> r, mid+1, r, pos, x);
//     }
//     v -> sum = v -> l -> sum + v -> r -> sum;
// }
void updmax(node *v, ll l, ll r, ll pos, ll x){
    if(l == r){
        v -> mx = {x, -l};
        return;
    }
    ll mid=(l+r)/2;
    if(mid >= pos){
        if(!(v -> l)){
            v -> l = new node();
            // v -> l -> sum = 0;
            v -> l -> mx = {-1, -1};
        }
        updmax(v -> l, l, mid, pos, x);
    }
    else{
        if(!(v -> r)){
            v -> r = new node();
            // v -> r -> sum = 0;
            v -> r -> mx = {-1, -1};
        }
        updmax(v -> r, mid+1, r, pos, x);
    }
    if(!(v -> l)){
        v -> l = new node();
    }
    if(!(v -> r)){
        v -> r = new node();
    }
    v -> mx = max(v -> l -> mx,  v -> r -> mx);
}

// ll getsum(node *v, ll l, ll r, ll L, ll R){
//     if(!v){
//         return 0;
//     }
//     if(r < L or R < l){
//         return 0;
//     }
//     if(L <= l and r <= R){
//         return t -> sum;
//     }
//     int mid=(l+r)/2;
//     return getsum(v->l, l, mid, L, R) + getsum(v->r, mid+1, r, L, R);
// }

// ll getk(node *v, ll l, ll r, ll k){
//     if()
// }




int ans[200100];

int main(){
    ll n, z;
    cin>>n>>z;
    int sz = 0;
    node *t = new node();
    // updsum(t, 1, n, 1, 1);
    // updsum(t, 1, n, n, 1);
    updmax(t, 1, n, 1, n-2);
    updmax(t, 1, n, n, 0);
    int ls = 0;
    set<ll> q; 
    q.insert(1);
    q.insert(n);
    while(z--){
        string c;
        cin>>c;
        if(c[0] == '+'){
            if(sz == 0){
                ls++;
                cout<<1<<'\n';
                sz++;
                continue;
            }
            if(sz == 1){
                ls++;
                cout<<n<<'\n';
                sz++;
                continue;
            }
            sz++;
            pll k = t -> mx;
            k = {k.ff, -k.ss};
            // cout<<k.ff<<' '<<k.ss<<'\n';
            ll pos =  k.ss + k.ff / 2 + k.ff % 2;
            // ans[] = pos;
            ans[++ls] = pos;
            ll r = *(q.lower_bound(pos));
            // cout<<k.ss<<' '<<r<<'\n';
            // updsum(t, 1, n, pos, 1);
            updmax(t, 1, n, k.ss, pos-k.ss-1);
            updmax(t, 1, n, pos, r-pos-1);
            cout<<pos<<'\n';
            q.insert(pos);
        }
        else{
            if(sz <= 2){
                sz--;
                continue;
            }
            sz--;
            ll k = 0;
            for(int i=1; i<c.size(); i++){
                k = k * 10 + c[i] - '0';
            }
            ll pos = ans[k];
            // cout<<k<<' '<<pos<<'\n';
            auto it = q.lower_bound(pos);
            ll l = *it;
            ll r = *it;
            l--;
            r++;
            updmax(t, 1, n, l, r-l-1);
            updmax(t, 1, n, pos, 0);
            q.erase(it);
            
            
        }
    }
}