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

int inf = -1e18 - 1;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    cin >> n >> k;
    set<pair<int, int>> ot, ot2;
    ot.emplace(-n, 1);
    ot2.emplace(1, -n);
    vector<int> v(k, 0);
    for (int i = 0; i < k; i++) {
        string s;
        cin >> s;
        if (s == "+") {
            pair<int, int> p = *ot.begin();
            ot.erase(ot.begin());
            v[i] = p.second + (-p.first - 1) / 2;
            ot.emplace(-(p.first - 1)/2, p.second);
            ot.emplace(-(p.first)/2, v[i] + 1);
            ot2.emplace(p.second, -(p.first - 1)/2);
            ot2.emplace(v[i] + 1, -(p.first)/2);
            cout << v[i] << '\n';
        }else {
            int num = v[-stoi(s) - 1];
            if (ot2.lower_bound({n, -inf}) == ot2.end()) {
                pair<int, int> p = *prev(ot2.end());
                ot2.erase(prev(ot2.end()));
                ot.erase(ot.find({p.second, p.first}));
                p.second--;
                ot2.insert(p);
                ot.insert({p.second, p.first});
            }else if (ot2.lower_bound({n, -inf}) == ot2.end()) {
                pair<int, int> p = *ot2.begin();
                ot2.erase(ot2.begin());
                p.second--;
                p.first--;
                ot2.insert(p);
                ot.insert({p.second, p.first});
            }else {
                pair<int, int> p2 = *ot2.lower_bound({num, -inf}),
                p1 = *prev(ot2.lower_bound({num, -inf})), p3 = {num, num};
                if (p2.second == num + 1) {
                    p3.second-=p2.first;
                    ot2.erase(p2);
                    ot.erase({p2.second, p2.first});
                }
                if (p1.second + p1.first == num) {
                    p3.first+=p1.first;
                    ot2.erase(p1);
                    ot.erase({p1.second, p1.first});
                }

            }
        }
    }
}

/*
 3 0 3
 1 2
 2 3
 3 1

 4 3 3
 1 2
 2 3
 3 4
 1 3
 4 2
 2 3

 3 1 1
 1 2
 2 3
 */