#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int inf = 1e9;
//using ld = long double;

int main() {
    cin.tie(0)->sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    vector<bool> vis(n + 1);
    vector<int> pos = {0};
    set<int, greater<>> used_left;
    set<int> used_right;
    vector<bool> unused(n + 1, true);
    set<pair<int, int>, greater<>> st;
    auto add = [&](int x) {
        used_left.insert(x);
        used_right.insert(x);
        unused[x] = false;
    };
    auto dist = [&](int x) {
        int dist = inf;
        if (used_left.lower_bound(x) != used_left.end()) {
            dist = min(dist, x - *used_left.lower_bound(x));
        }
        if (used_right.lower_bound(x) != used_right.end()) {
            dist = min(dist, *used_right.lower_bound(x) - x);
        }
        return dist;
    };
    int cnt = 0;
    while (q--) {
        string op;
        cin >> op;
//        cout << "st: ";
//        for (auto [x, y]: st) cout << x << ' ' << y << ' ';
//        cout << endl;
        if (op == "+") {
            cnt++;
            if (used_left.empty()) {
                cout << 1 << '\n';
                pos.emplace_back(1);
                add(1);
                continue;
            }
            if (unused[1]) st.emplace(dist(1), -1);
            if (unused[n]) st.emplace(dist(n), -n);
            while (!st.empty() and !unused[-st.begin()->second]) st.erase(st.begin());
            pos.emplace_back(-st.begin()->second);
            cout << pos[cnt] << '\n';
            add(pos[cnt]);
            st.erase(st.begin());

//            cout << "left: ";
//            for (int x: used_left) cout << x << ' ';
//            cout << endl;

            if (used_left.upper_bound(pos[cnt]) != used_left.end()) {
                int md = (*used_left.upper_bound(pos[cnt]) + pos[cnt]) / 2;
                if (unused[md]) st.emplace(dist(md), -md);
            }
            if (used_right.upper_bound(pos[cnt]) != used_right.end()) {
                int md = (*used_right.upper_bound(pos[cnt]) + pos[cnt]) / 2;
                if (unused[md]) st.emplace(dist(md), -md);
            }
        } else {
            int x = -stoi(op);
//            cout << '\t' << x << endl;
            x = pos[x];
            used_left.erase(x);
            used_right.erase(x);
            unused[x] = true;
            if (used_left.lower_bound(x) == used_left.end()) {
                continue;
            }
            if (used_right.lower_bound(x) == used_right.end()) {
                continue;
            }
            int left = *used_left.lower_bound(x);
            int right = *used_right.lower_bound(x);
//            cout << "\t added: " << left << ' ' << right << endl;
            st.emplace(dist((left + right) / 2), -((left + right) / 2));
        }
    }
}