#include <bits/stdc++.h>
using namespace std;
using ll = long long;
mt19937_64 rnd(time(0));
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()

const ll N = 2e5 + 5;
const ll INF = 3e18;

double binpow(double n, ll p) {
    if (p == 1) return n;
    if (p % 2 == 0) {
        double f = binpow(n, p / 2);
        return f * f;
    }
    return binpow(n, p - 1) * n;
}

set<pair<ll, ll>> r;
set<ll> p;
map<ll, ll> seg;

void add(ll x) {
    auto it = p.lower_bound(x);
    it--;
    ll lp = *it;
    it++;
    ll rp = *it;

    r.erase({(rp - lp) / 2, -lp});
    r.insert({(x - lp) / 2, -lp});
    r.insert({(rp - x) / 2, -x});
    seg[lp] = x;
    seg[x] = rp;
    p.insert(x);
}

void del(ll x) {
    auto it = p.lower_bound(x);
    it--;
    ll lp = *it;
    it++; it++;
    ll rp = *it;

    r.erase({(x - lp) / 2, -lp});
    r.erase({(rp - x) / 2, -x});
    r.insert({(rp - lp) / 2, -lp});
    seg[lp] = rp;
    p.erase(x);
}


void solve() {
    ll n, q; cin >> n >> q;
    p.insert(-INF);
    p.insert(INF);
    r.insert({INF - (-INF) - 1, -(-INF)});
    seg[-INF] = INF;

    vector<ll> who(q + 1);
    ll cnt = 1;
    while (q--) {
        char ty; cin >> ty;
        if (ty == '+') {
            auto cur = r.end();
            cur--;
            while ((*cur).first > n / 2 + 5) {
                cur--;
                if (cur == r.begin()) {
                    break;
                }
            }

            ll best = -1, ans = -1;

            if (p.size() == 2) {
                ans = 1;
            } else {
                auto it1 = p.begin(); it1++;
                ll len1 = *it1 - 1ll;
                auto it2 = p.end(); it2--; it2--;
                ll len2 = n - *it2;

                if (best < len2) {
                    best = len2;
                    ans = n;
                }

                if (best <= len1) {
                    best = len1;
                    ans = 1;
                }

                if (p.size() >= 4) {
                    auto mid = *cur;
                    mid.second = -mid.second;

                    if (best < mid.first || (best == mid.first && mid.second + mid.first < ans)) {
                        best = mid.first;
                        ans = mid.second + mid.first;
                    }
                }
            }
            cout << ans << '\n';
            who[cnt++] = ans;
            add(ans);
        } else {
            ll x; cin >> x;
            del(who[x]);
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    solve();

    return 0;
}