#include <bits/stdc++.h>

using namespace std;

//#pragma GCC optimaze("O3")
//#pragma GCC optimaze("Ofast")
//#pragma GCC optimaze("unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")

#include <bits/stdc++.h>

#define int int64_t
#define ll long long

const int MOD = 1e9 + 7;

using namespace std;
int z[100001];
map<int, pair<int, int>> mp;

void solve() {
    int n, k;
    cin >> n >> k;
    auto cmp = [](pair<int, int> a, pair<int, int> b) {
        if (a.second - a.first == b.second - b.first) {
            return a.first < b.first;
        }
        return a.second - a.first - (a.second - a.first) % 2 > b.second - b.first - (b.second - b.first) % 2;
    };
    set<pair<int, int>, decltype(cmp)> st(cmp);
    int cnt = 0, zcnt = 0, nl;
    for (int i = 0; i < k; ++i) {
        char c;
        cin >> c;
        if (c == '+') {
            if (cnt == 0) {
                z[zcnt++] = 1;
                nl = 1;
                cout << 1 << '\n';
            } else if (cnt == 1) {
                if (nl - 1 >= n - nl) {
                    z[zcnt++] = 1;
                    cout << 1 << '\n';
                    mp[1] = {-1, nl};
                    mp[nl] = {1, -1};
                    st.insert({1, nl});
                } else {
                    z[zcnt++] = n;
                    cout << n << '\n';
                    mp[n] = {nl, -1};
                    mp[nl] = {-1, n};
                    st.insert({nl, n});
                }

            } else {
                auto [a, b] = *st.begin();
                st.erase(st.begin());
                cout << (a + b) / 2 << '\n';
                mp[(a + b) / 2] = {a, b};
                mp[a].second = (a + b) / 2;
                mp[b].first = (a + b) / 2;
                st.insert({a, (a + b) / 2});
                st.insert({(a + b) / 2, b});
                z[zcnt++] = (a + b) / 2;
            }
            ++cnt;
        } else {
            int man;
            cin >> man;
            --man;
            if (cnt == 1) {
                mp[nl] = {-1, -1};
            } else if (cnt == 2) {
                auto [a, b] = *st.begin();
                st.erase(st.begin());
                mp[b] = {-1, -1};
                nl = a ^ b ^ z[man];
                mp[a] = {-1, -1};
            } else {
                auto [a, b] = mp[z[man]];
                st.erase({a, z[man]});
                st.erase({z[man], b});
                if (a != -1 || b != -1) {
                    st.insert({a, b});
                }
            }
            --cnt;
        }
    }
}

signed main() {
//    int t;
//    cin >> t;
    for (int i = 0; i < 1; ++i) {
        solve();
    }
    return 0;
}
