#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <random>
#include <numeric>
#include <map>
#include <set>
#include <string>
#include <iomanip>

using namespace std;
using ll = long long;
using ld = long double;

#define deb(x) cerr << #x << ":\t" << x << '\n';
#define len(x) (ll) x.size()
#define ff first
#define ss second

const ll INF = 8e18;
const ll MOD = 1e9 + 7;

struct st {
    ll l, r;
};

bool operator<(st a, st b) {
    if (a.r - a.l == b.r - b.l) {
        if (a.l == b.l) {
            return a.r < b.r;
        }
        return a.l < b.l;
    }
    return a.r - a.l > b.r - b.l;
}

void solve() {
    ll n, Q; cin >> n >> Q;
    set <st> seg;
    set <ll> now;
    map <ll, ll> place;
    ll nomer = 1;
    while (Q--) {
        char cmd; cin >> cmd;
        if (cmd == '+') {
            ll q = -INF, w = -INF, e = -INF;
            if (len(now) && *now.begin() != 1) {
                q = *now.begin() - 2;
            }
            if (len(now) && *now.rbegin() != n) {
                e = n - *now.rbegin() - 1;
            }
            if (len(now) > 1) {
                auto [l, r] = *seg.begin();
                if (l + 1 != r) {
                    ll m = (l + r) / 2;
                    w = min(m - l - 1, r - m - 1);
                }
            }
            ll mx = max({q, w, e});
            if (q == mx) {
                place[nomer] = 1;
                if (len(now)) {
                    seg.insert({1, *now.begin()});
                }
                now.insert(1);
            } else if (w == mx) {
                auto [l, r] = *seg.begin();
                seg.erase(seg.begin());
                ll m = (r + l) / 2;
                seg.insert({l, m});
                seg.insert({m, r});
                place[nomer] = m;
                now.insert(m);
            } else if (e == mx) {
                place[nomer] = n;
                seg.insert({*now.rbegin(), n});
                now.insert(n);
            }
            cout << place[nomer] << '\n';
            nomer++;
        } else {
            ll ind; cin >> ind;
            ll x = place[ind];
            if (*now.begin() == x) {
                if (len(now) > 1) {
                    ll r = *(++now.begin());
                    seg.erase({x, r});
                }
            } else if (*now.rbegin() == x) {
                if (len(now) > 1) {
                    ll l = *(++now.rbegin());
                    seg.erase({l, x});
                }
            } else {
                auto it = now.lower_bound(x);
                it++;
                ll r = *it;
                it--, it--;
                ll l = *it;
                seg.erase({l, x});
                seg.erase({x, r});
                seg.insert({l, r});
            }
            place.erase(ind);
            now.erase(x);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int T = 1;
//    cin >> T;
//    cout << setprecision(9) << fixed;
    while (T--) {
        solve();
    }
    return 0;
}
