//#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define ent "\n"
#define int long long
#define f first
#define s second

const int maxn = 2e5 + 100;
const int inf = (int)1e9 + 100;
const ll INF = (ll)1e18;
const int MOD = 1e9 + 7;
const int maxl = 20;
const ll P = 31;

int n, k;
int p[maxn];
set<int> s;
set<pii> t;

void add(int l, int r){
    if(l == r + 1) return;
    int mid = (l + r) >> 1;
    t.insert({min(r - mid - 1, mid - l - 1), -mid});
}

void del(int l, int r){
    if(l == r + 1) return;
    int mid = (l + r) >> 1;
    t.erase({min(r - mid - 1, mid - l - 1), -mid});
}

void test(){
    cin >> n >> k;
    int cnt = 0;
    for(int i = 1; i <= k; i++){
        char c; cin >> c;
        if(c == '+'){
            cnt++;
            int a[] = {-INF, -INF, -INF};
            if(s.empty() || *s.begin() > 1){
                if(s.size()) a[0] = (*s.begin() - 2);
                else a[0] = n - 1;
            }
            if(s.size()  || *s.rbegin() < n) {
                if(s.size() < n) a[2] = n - *s.rbegin() - 1;
                else a[2] = n - 1;
            }
            if(t.size()) a[1] = t.rbegin()->first;
            if(a[0] >= a[1] && a[0] >= a[2]) p[cnt] = 1;
            else if(a[1] >= a[0] && a[1] >= a[2]){
                p[cnt] = -t.rbegin()->second;
            } else p[cnt] = n;
            s.insert(p[cnt]);
            auto it = s.find(p[cnt]);
            int l = 0, r = 0;
            if(it != --s.end()) r = *++it, it--;
            if(it != s.begin()) l = *--it, it++;
            if(l) add(l, p[cnt]);
            if(r) add(p[cnt], r);
            if(l && r) del(l, r);
            cout << p[cnt] << ent;
        } else{
            int x; cin >> x;
            auto it = s.find(p[x]);
            int l = 0, r = 0;
            if(it != --s.end()) r = *++it, it--;
            if(it != s.begin()) l = *--it, it++;
            if(l) del(l, p[x]);
            if(r) del(p[x], r);
            if(l && r) add(l, r);
            s.erase(p[x]);
        }
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t; t = 1;
    while(t--) test();
}

//5 9
//+
//-1
//+
//+
//+
//+
//-4
//+
//+
