#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair < ll, ll >;

bool cmp(pii a, pii b) {
    return a.first > b.first || (a.first == b.first && a.second < b.second);
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    
    ll n, k; char op; ll j; cin >> n >> k;

    ll pos[k + 1];

    set < ll > used;

    set < pii, decltype(&cmp) > s1(cmp);
    set < pii > s2;

    ll cnt = 0, id = 0;

    for (ll i = 1; i <= k; i++) {
        cin >> op;

        if (op == '+') {
            cnt++, id++;

            if (used.empty()) {
                pos[id] = 1;
                used.insert(1);
                cout << 1 << "\n";

                continue;
            } else if (used.size() == 1) {
                if (used.count(1)) {
                    pos[id] = n;
                    used.insert(n);
                    cout << n << "\n";
                } else {
                    pos[id] = 1;
                    used.insert(1);
                    cout << 1 << "\n";
                }

                s1.insert({ n, 1 });
                s2.insert({ 1, n });

                continue;
            }

            auto [len, l] = *s1.begin();

            ll r = l + len - 1;
            ll m = (l + r) / 2;

            ll a = !used.count(1) ? s2.begin()->second : 0;
            ll b = !used.count(n) ? n - (--s2.end())->first + 1 : 0;

            ll mx = max({ m - l + 1, a, b });

            if (mx == m - l + 1) {
                pos[id] = m;
                used.insert(m);
                cout << m << "\n";

                s1.erase({ len, l });
                s2.erase({ l, r });
                s1.insert({ m - l + 1, l });
                s1.insert({ r - m + 1, m });
                s2.insert({ l, m });
                s2.insert({ m, r });
            } else if (mx == a) {
                pos[id] = 1;
                used.insert(1);
                cout << 1 << "\n";

                s1.insert({ a, 1 });
                s2.insert({ 1, a });
            } else if (mx == b) {
                pos[id] = n;
                used.insert(n);
                cout << n << "\n";

                s1.insert({ b, (--s2.end())->first });
                s2.insert({ (--s2.end())->first, n });
            }
        } else {
            cin >> j; cnt--;

            used.erase(pos[j]);

            if (cnt == 0) {
                continue;
            } else if (cnt == 1) {
                s1.clear(), s2.clear();
                continue;
            }

            auto [l1, r1] = *(--s2.lower_bound({ pos[j], -1 }));
            ll l2 = n, r2 = n;
            
            if (pos[j] != n)
                l2 = s2.lower_bound({ pos[j], -1 })->first,
                r2 = s2.lower_bound({ pos[j], -1 })->second;

            s2.erase({ l1, r1 });
            s2.erase({ l2, r2 });
            s1.erase({ r1 - l1 + 1, l1 });
            s1.erase({ r2 - l2 + 1, l2 });
            s2.insert({ l1, r2 });
            s1.insert({ r2 - l1 + 1, l1 });
        }
    }
}
