#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize("03")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,bmi2,fma")

using namespace std;
//using namespace __gnu_pbds;

//gp_gash_table<int,int>mp;
#define ll long long
#define pb push_back
#define ld long double
#define endl '\n'
#define all(a) a.begin(), a.end()

const ll INF = 2e18, MOD = 1e9 + 7, MAXN = 2e5;

struct point {
    ll x, y;
};

bool comp(int i, pair<int, int> j) {
    return i < j.first;
}

void solve() {
    int n, k;
    cin >> n >> k;
    set<pair<int, int>> chel;
    set<pair<int, int>> rast;
    rast.insert({0, 0});
    rast.insert({-n + 1, 1});
    chel.insert({0, 0});
    chel.insert({1, -n + 1});

    int cheburek = 2;
    cout << 1 << "\n";
    map<int, int> mp;
    mp[1] = 1;
    mp[0] = 0;
    int kol = 1;
    for (int i = 0; i < k; i++) {
        char u;
        cin >> u;
        if (!i) {
            continue;
        }
        if (u == '+') {
            if (kol == 0) {
                rast.erase({-n, 0});
                chel.erase({0, -n});
                rast.insert({0, 0});
                chel.insert({0, 0});
                rast.insert({-(n - 1), 1});
                chel.insert({1, -(n - 1)});
                mp[cheburek] = 1;
                kol++;
                cheburek++;
                cout << 1 << "\n";
                continue;
            }
            auto [r, human] = *rast.begin();
            r = -r;
            if (human + r == n) {
                chel.erase({human, -r});
                rast.erase({-r, human});
                rast.insert({0, n});
                chel.insert({human, -(r - 1)});
                chel.insert({n, 0});
                rast.insert({-(r - 1), human});
                mp[cheburek] = n;
                cheburek++;
                cout << n << "\n";
            } else {
                rast.erase(rast.begin());
                chel.erase({human, -r});
                rast.insert({-((r - 1) / 2), human});
                rast.insert({-(r / 2), human + (r - 1) / 2  + 1});
                chel.insert({human, -((r - 1) / 2)});
                chel.insert({human + (r - 1) / 2 + 1, -(r / 2)});
                mp[cheburek] = human + (r - 1) / 2 + 1;
                cheburek++;
                cout << human + (r - 1) / 2 + 1 << endl;
            }
            kol++;
        } else {
            int a;
            cin >> a;
            auto [human, r] = *chel.lower_bound({mp[a], -INF});
            auto [human_last, r_last] = *(--chel.lower_bound({mp[a], -INF}));
            r = -r;
            r_last = -r_last;
            chel.erase({human, -r});
            chel.erase({human_last, -r_last});
            chel.insert({human_last, -(r + r_last + 1)});
            rast.erase({-r, human});
            rast.erase({-r_last, human_last});
            rast.insert({-(r_last + r + 1), human_last});
            kol--;
        }
    }
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}