#include <bits/stdc++.h>

#define fi first
#define se second

#define pw(x) (1LL << x)
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define sz(x) (int)(x).size()

using namespace std;

template < typename T >
bool umn (T& a, T  b) {return a > b ? a = b, 1 : 0;}
template < typename T >
bool umx (T& a, T  b) {return a < b ? a = b, 1 : 0;}

using ll = long long;
using ld = long double;

const int N = 1e6 + 5;

set <array <ll, 2>> s;
set <array <ll, 4>> st;

ll n, k;

void make_sigm(ll l, ll r) {
    s.insert({l, r});
    ll pos, res;
    if (l == 0) {
        pos = 1;
        res = r - 2;
    } else if (r == n + 1) {
        pos = n;
        res = r - l - 2;
    } else {
        pos = (l + r) / 2;
        res = min(pos - l - 1, r - pos - 1);
    }
    st.insert({res, -pos, l, r});
}

array <ll, 4> calc(ll l, ll r) {
    ll pos, res;
    if (l == 0) {
        pos = 1;
        res = r - 2;
    } else if (r == n + 1) {
        pos = n;
        res = r - l - 2;
    } else {
        pos = (l + r) / 2;
        res = min(pos - l - 1, r - pos - 1);
    }
    return {res, -pos, l, r};
}

int main() {
#ifdef localy
    freopen ("input.txt", "r", stdin);
    freopen ("output.txt", "w", stdout);
#endif // localy
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> k;

    make_sigm(0, n + 1);

    vector <ll> res(k + 5);

    int cnt = 1;

    for (int i = 1; i <= k; i++) {
        char t;
        cin >> t;
        if (t == '+') {
            array <ll, 4> m = *--st.end();
            cout << -m[1] << "\n";
            res[cnt] = -m[1];
            st.erase(m);
            s.erase({m[2], m[3]});
            make_sigm(m[2], -m[1]);
            make_sigm(-m[1], m[3]);
            cnt++;
        } else {
            ll x;
            cin >> x;
            x = res[x];

            auto it = s.lower_bound({x, -1});
            array <ll, 2> R = *it;
            --it;
            array <ll, 2> L = *it;
            s.erase(L);
            s.erase(R);
            st.erase(calc(L[0], L[1]));
            st.erase(calc(R[0], R[1]));
            make_sigm(L[0], R[1]);
        }
    }

    return 0;
}
