// Bolatulu
#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
#define int long long
#define kanagattandirilmagandiktarinizdan ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define F first
#define S second
#define md (tl+tr)/2
#define TL v+v,tl,md
#define TR v+v+1,md+1,tr

#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

using namespace std;

db binpow(db a,db n) {
    if (n==0)
        return (db)1;
    int zz=n;
    if (zz%2!=0)
        return (a * binpow(a,n-1));
    db z=binpow(a,n/2);
    return (z*z);
}

const ll INF = 1e18;
const int N =  2e6+7;
const int M = 1e9+7;
const ll HZ = 1e5;
const int MAX = INT_MAX;
const int MIN = INT_MIN;
const db pi = 3.141592653;
const int P=31;

int n,k,del[N];

void solve() {
    cin >> n >> k;
    set <pair <int,int>> s;
    set <int> st;
    int zz=1;
    while (k--) {
        char tp;
        int x;
        cin >> tp;
        if (tp=='+') {
            if (st.empty()) {
                del[zz]=1;
                cout << 1 << '\n';
                st.insert(1);
                zz++;
                continue;
            }
            if (s.empty()) {
                if (*st.begin()-1>=n-*st.begin())
                    s.insert({-*st.begin()+2,1}), st.insert(1), cout << 1 << '\n', del[zz]=1;
                else
                    s.insert({-n+*st.begin()+1,*st.begin()}), st.insert(n), cout << n << '\n', del[zz]=n;
                zz++;
                continue;
            }
            pair <int,int> z=*s.begin();
            int zr=*st.upper_bound(z.second);
            z.first*=-1;
            int pos=z.second+z.first/2+z.first%2;
            if (zr-1-pos<=*st.begin()-2 and *st.begin()-2>=n-*st.rbegin()-1) {
                cout << 1 << '\n';
                del[zz]=1;
                s.insert({-*st.begin()+2,1}), st.insert(1);
                zz++;
                continue;
            }
            if (n-*st.rbegin()-1>zr-1-pos) {
                cout << n << '\n';
                del[zz]=n;
                s.insert({-n+*st.rbegin()+1,n}), st.insert(n);
                zz++;
                continue;
            }
            cout << pos << '\n';
            del[zz]=pos;
            int r=*st.upper_bound(pos);
            z.first*=-1;
            s.erase(z), s.insert({-(pos-1-z.second),z.second}), s.insert({-(r-pos-1),pos}), st.insert(pos);
            zz++;
        } else {
            cin >> x;
            x=del[x];
            int len=-1;
            if (*st.rbegin()!=x) {
                len = *st.upper_bound(x) - 1 - x;
                s.erase({-len, x});
            }
            st.erase(x);
            auto z=st.upper_bound(x);
            if (z==st.begin())
                continue;
            z--;
            s.erase({-(x-1-*z),*z});
            if (len!=-1)
                s.insert({-(x-1-*z+len),*z});
        }
    }
}
signed main() {
    // freopen("lca.in", "r", stdin);
    // freopen("lca.out", "w", stdout);
    kanagattandirilmagandiktarinizdan
    int test = 1, count = 1;
    // cin >> test;
    while (test--) {
        // cout << "Case " << count << ":\n";
        solve();
        if (test)
            // cout << '\n';
            count++;
    }
    return 0;
}