#include<bits/stdc++.h>

#define ll long long
#define ld long double
#define fir first
#define sec second
#define int long long
#define pb push_back
#define mp make_pair
#define vec vector
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

using namespace std;

const int MAX = 2e5 + 7;
int q, n;


pair<ll, ll> f(pair<ll, ll> x) {
    auto [l, r] = x;
    if (l == 0 && r == n + 1) return {-2e18, 1};
    if (r == n + 1) return {-((r - 1) - l), (r - 1)};
    if (l == 0) return {-(r - 1), l + 1};
    ll mid = (l + r) >> 1;
    return {-min(mid - l, r - mid), mid};
}

void solve3() {
    cin >> n >> q;
    set<ll> p;
    p.insert(0);
    p.insert(n + 1);
    set<pair<ll, ll>> st;
    ll x[q + 1];
    ll cnt = 1;
    st.insert(f({0, n + 1}));
    while (q--) {
        char sym;
        cin >> sym;
        if (sym == '+') {
            auto [val, pos] = *st.begin();
            st.erase(st.begin());
            p.insert(pos);
            x[cnt] = pos;
            cnt++;
            auto it = p.find(pos);
            ll l, r;
            --it;
            l = *it;
            ++it;
            ++it;
            r = *it;
            st.insert(f({l, pos}));
            st.insert(f({pos, r}));
            cout << pos << '\n';
        } else {
            int ind;
            cin >> ind;
            ll pos = x[ind];
            auto it = p.find(pos);
            ll l, r;
            --it;
            l = *it;
            ++it;
            ++it;
            r = *it;
            st.erase(f({l, pos}));
            st.erase(f({pos, r}));
            st.insert(f({l, r}));
            p.erase(pos);
        }
    }
}

int32_t main () {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve3();
}
