#include<bits/stdc++.h>

using namespace std;
using ll = long long;

const ll INF = 1e18;

struct Prior {
    ll len;
    ll lb;
};
bool operator < (Prior x, Prior y) {
    if(x.len == y.len) return x.lb < y.lb;
    return x.len > y.len;
}
struct Segment {
    ll l, r;
};
bool operator < (Segment x, Segment y) {
    return x.l < y.l;
};

ll n, k;

vector<ll> ord(1); 
set<ll> pass;
set<pair<Prior, Segment>> prior;
set<Segment> seg;

void insert(Segment a) {
    if(a.l > a.r) return;
    prior.insert({{a.r - a.l + 1, a.l}, a});
    seg.insert(a);
}
void erase(Segment a) {
    if(a.l > a.r || !seg.count(a)) return;
    prior.erase({{a.r - a.l + 1, a.l}, a});
    seg.erase(a);
}

Segment find_seg(ll pos) {
    if(pass.count(pos)) return {INF, -INF};
    auto it = pass.upper_bound(pos);

    auto lb = it; lb--;
    return {*lb + 1, *it - 1};
}

Segment right_bnd(ll pos) {
    auto it = seg.upper_bound({pos, INF});
    if(it == seg.end()) return {INF, -INF};
    return *it;
}
Segment left_bnd(ll pos) {
    auto it = (seg.upper_bound({pos, INF}));
    if(seg.empty() || it == seg.begin()) return {INF, -INF};
    return *(--it);
}

void insert_point(ll pos) {
    if(pass.count(pos)) return;
    // cout << pos << '\n';
    // cout << "BEFORE:\n";
    // cout << "segs: ";
    // for(auto [x, y] : seg) {
    //     cout << '('<< x << ' ' << y << ')' << ' ';
    // }
    // cout << '\n';
    Segment cur = find_seg(pos);
    // cout << cur.l << ' ' << cur.r << '\n';
    erase(cur);
    insert({cur.l, pos - 1});
    insert({pos + 1, cur.r});
    pass.insert(pos);

    // cout << "AFTER:\n";
    // cout << "segs: ";
    // for(auto [x, y] : seg) {
    //     cout << '('<< x << ' ' << y << ')' << ' ';
    // }
    // cout << '\n';
}


ll func(ll pos) {
    if(pass.count(pos)) return 0;
    ll l = *(--pass.lower_bound(pos)), r = *pass.lower_bound(pos);
    ll ans = INF;
    if(l >= 1) ans = min(ans, pos - l);
    if(r <= n) ans = min(ans, r - pos);
    return ans;
}

ll add() {
    if((int)pass.size() == 2) {
        insert_point(1);
        return 1;
    }
    Segment cur = (prior.begin())->second;
    // cout << "thick: " << cur.l << ' ' << cur.r << '\n';
    ll pos = (cur.l + cur.r) / 2;
    if(func(1) >= func(pos)) pos = 1;
    if(func(n) > func(pos)) pos = n;
    insert_point(pos);

    // cout << "AFTER\n";
    // cout << "segs: ";
    // for(auto [x, y] : seg) {
    //     cout << '('<< x << ' ' << y << ')' << ' ';
    // }
    // cout << '\n';
    return pos;
}
void del(ll pos) {
    Segment lb = find_seg(pos - 1), rb = find_seg(pos + 1);
    erase(lb); erase(rb);
    Segment t;
    t.l = min(lb.l, pos), t.r = max(rb.r, pos);
    insert(t);
    pass.erase(pos);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);

    cin >> n >> k;

    insert({1, n});
    pass.insert(0);
    pass.insert(n + 1);

    while(k--) {
        char x;
        cin >> x;
        ll inx;
        if(x == '+') {
            ord.push_back(add());
            cout << ord.back() << '\n';
        } else {
            cin >> inx;
            del(ord[inx]);
        }
    }
}

