#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;

struct segm {
    int l, r;
    segm(int l, int r) : l(l), r(r) { }
    bool operator<(segm b) const {
        int l1 = (r - l + 1) / 2, l2 = (b.r - b.l + 1) / 2;
        if (l == 1 || r == n)
            l1 = r - l;
        if (b.l == 1 || b.r == n)
            l2 = b.r - b.l;

        return l1 > l2 || (l1 == l2 && l < b.l);
    }
};

void solve2 () {
    cin >> n >> q;
    set < segm > s;
    set < int > p;
    int x[q];
    int kol = 1;
    s.insert(segm(1, n));
    p.insert(0);
    p.insert(n + 1);
    for (int i = 0; i < q; ++i) {
//        for (auto [l, r] : s)
//            cout << l << " " << r << "\n";
        char t;
        cin >> t;
        if (t == '+') {
            auto [l, r] = *s.begin();
            s.erase(s.begin());
            if (l == 1) {
                s.insert(segm(l + 1, r));
                p.insert(l);
                x[kol++] = l;
                cout << l << "\n";
                continue;
            }
            if (r == n) {
                s.insert(segm(l, r - 1));
                p.insert(r);
                x[kol++] = r;
//                cout << "l r - 1 " << l << " " << r - 1 << "\n";
                cout << r << "\n";
                continue;
            }
            int md = (l + r) >> 1;
            s.insert(segm(l, md - 1));
            s.insert(segm(md + 1, r));
            p.insert(md);
            x[kol++] = md;
            cout << md << "\n";
        } else {
            int ind;
            cin >> ind;
            int x1 = x[ind];
            int it = *p.upper_bound(x1);
            int it1 = *--p.lower_bound(x1);
            if (x1 == 1) {
                p.erase(1);
                s.erase(segm(2, it));
                s.insert(segm(1, it));
                continue;
            }
            if (x1 == n) {
                p.erase(n);
                s.erase(segm(it1, n - 1));
                s.insert(segm(it1, n));
                continue;
            }
            s.erase(segm(it1 + 1, x1 - 1));
            s.erase(segm(x1 + 1, it - 1));
            s.insert(segm(it1 + 1, it - 1));
            p.erase(x1);
        }
//        cout << sz(s) << "\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<pair<ll, ll>, pair<ll, ll>>> st;
    ll x[q + 1];
    ll cnt = 1;
    st.insert({f({0, n + 1}), {0, n + 1}});
    while (q--) {
        char sym;
        cin >> sym;
        if (sym == '+') {
            auto [A, B] = *st.begin();
            st.erase(st.begin());
            auto [l, r] = B;
            auto [val, pos] = A;
            p.insert(pos);
            auto it = p.find(pos);
            x[cnt] = pos;
            cnt++;
            --it;
            st.insert({f({*it, pos}), {*it, pos}});
            ++it;
            ++it;
            st.insert({f({pos, *it}), {pos, *it}});
            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}), {l, pos}});
            st.erase({f({pos, r}), {pos, r}});
            st.insert({f({l, r}), {l, r}});
        }
    }
}

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