#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second
#define vt vector
#define pb push_back
#define ppb pop_back
#define all(a) a.begin(), a.end()
#define ent "\n"
#define sp ' '

using ll  = long long;
using db  = double;
using ldb = long double;
using pll = pair <ll, ll>;
using pii = pair <int, int>;

const ll  INF = 8e18;
const ll  inf = 1e9 + 7;
const int MOD = 998244353;
const int bln = 200;
const int M   = 1e2 + 7;
const int N   = 1e6 + 7;

/*-------------------------main-------------------------*/

int a[N];
void solve() {
    #define test
    ll n;
    int m; cin >> n >> m;
    set<ll> cur;
    vector<ll> query;
    set<pair<ll, ll>> st, str;
    for(int i = 1; i <= m; ++i) {
        char s; cin >> s;
        if(s == '+') {
            if(cur.empty()) {
                cout << 1 << "\n";
                cur.insert(1);
                query.push_back(1);
                st.insert({n - 1, -n});
            }
            else {
                auto bck = *st.rbegin();
                st.erase(--st.end());
                ll num = -bck.second, dist = bck.first;
                cout << num << "\n";
                if(cur.lower_bound(num + 1) == cur.end()) {
                    if(num != n) st.insert({n - num, -n});
                }
                else {
                    auto next = *cur.lower_bound(num + 1);
                    ll mid = (next + num) / 2;
                    if(mid != next && mid != num) {
                        st.insert({min(mid - num, next - mid), -mid});
                    }
                    mid = (next + num - 1) / 2;
                    if(mid != next && mid != num) {
                        st.insert({min(mid - num, next - mid), -mid});
                    }
                }
                if(cur.lower_bound(num) == cur.begin()) {
                    if(num != 1) st.insert({num - 1, -1});
                }
                else {
                    auto next = *(--cur.lower_bound(num));
                    ll mid = (next + num) / 2;
                    if(mid != next && mid != num) {
                        st.insert({min(num - mid, mid - next), -mid});
                    }
                    mid = (next + num - 1) / 2;
                    if(mid != next && mid != num) {
                        st.insert({min(num - mid, mid - next), -mid});
                    }
                }
                cur.insert(num);
                query.push_back(num);
            }
        }
        else {
            ll num;
            cin >> num;
            num--;
            num = query[num];
            cur.erase({num});
            ll PREV = 0, NEXT = n + 1;
            if(cur.lower_bound(num + 1) == cur.end()) {
                if(num != n) st.erase({n - num, -n});
            }
            else {
                auto next = *cur.lower_bound(num + 1);
                NEXT = next;
                ll mid = (next + num) / 2;
                if(mid != next && mid != num) {
                    st.erase({min(mid - num, next - mid), -mid});
                }
                mid = (next + num - 1) / 2;
                if(mid != next && mid != num) {
                    st.erase({min(mid - num, next - mid), -mid});
                }
            }
            if(cur.lower_bound(num) == cur.begin()) {
                if(num != 1) st.erase({num - 1, -1});
            }
            else {
                auto next = *(--cur.lower_bound(num));
                PREV = next;
                ll mid = (next + num) / 2;
                if(mid != next && mid != num) {
                    st.erase({min(num - mid, mid - next), -mid});
                }
                mid = (next + num - 1) / 2;
                if(mid != next && mid != num) {
                    st.erase({min(num - mid, mid - next), -mid});
                }
            }
            if(PREV == 0 && NEXT == n + 1) {}
            else if(PREV == 0) {
                if(NEXT != 1) st.insert({NEXT - 1, -1});
            }
            else if(NEXT == n + 1) {
                if(PREV != n) st.insert({n - PREV, -n});
            }
            else {
                ll mid = (NEXT + PREV) / 2;
                if(mid != NEXT && mid != PREV) {
                    st.insert({min(NEXT - mid, mid - PREV), -mid});
                }
                mid = (NEXT + PREV - 1) / 2;
                if(mid != NEXT && mid != PREV) {
                    st.insert({min(NEXT - mid, mid - PREV), -mid});
                }
            }
        }
    }
}

void precalc() {
}

signed main() {
//  freopen("guard.in", "r", stdin);
//  freopen("guard.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    precalc();
    int testcases;
    #ifdef tests
        cin >> testcases;
    #endif
    #ifdef test
        testcases = 1;
    #endif
    while (testcases--) {
        solve();
    }
    return 0;
}
