#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <cstdio>
#include <random>
#include <chrono>

using namespace std;

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

mt19937_64 rnd(chrono::steady_clock::now().time_since_epoch().count());

//#define int long long
#define all(x) (x).begin(), (x).end()

void solve() {
    int n, k;
    cin >> n >> k;
    set<vector<int>> s;
    set<int> p;
    s.insert({-n, 1, n});
    vector<int> num(k + 1);
    int cnt = 0;
    p.insert(0);
    p.insert(n + 1);
    while (k--) {
        char c;
        cin >> c;
        if (c == '+') {
            cnt++;
            auto it = s.begin();
            auto t = *it;
            s.erase(it);
            t[0] = -t[0];
            int l = (t[0] - 1) / 2;
            int r = t[0] - l - 1;
            if (t[1] == 1)
                l = 0, r = t[0] - 1;
            else if (t[2] == n)
                l = t[0] - 1, r = 0;
            s.insert({-l, t[1], t[1] + l - 1});
            s.insert({-r, t[1] + l + 1, t[2]});
            cout << t[1] + l << '\n';
            p.insert(t[1] + l);
            num[cnt] = t[1] + l;
            continue;
        }
        int x;
        cin >> x;
        x = num[x];
        auto it = p.find(x);
        auto itl = it;
        auto itr = it;
        itl--;
        itr++;
        int l = *itl;
        int r = *itr;
        p.erase(x);
        s.erase({-(x - 1 - l), l + 1, x - 1});
        s.erase({-(r - x - 1), x + 1, r - 1});
        s.insert({-(r - l - 1), l + 1, r - 1});
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll timer = 1;
    // cin >> timer;
    while (timer--) {
        solve();
    }
    return 0;
}

/*
#.#.#.....
.......##.
.#..#.....
.#........
.#..##....
..........
####...#..
.......#..
.......#..
##........

 */