#include<bits\stdc++.h>
#define ll long long
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n, k;
  cin >> n >> k;
  set<array<ll, 3>> s;
  set<ll> p;
  int val[k + 1], cnt = 1;
  while (k--) {
    char tp;
      cin >> tp;
      if (tp == '-') {
        int x;
        cin >> x;
        int ps = val[x];   
        p.erase(ps);
        if (p.empty()) continue;
        auto r = p.upper_bound(ps);
      if (r == p.end()) {
        s.erase({ps - *--p.end(), -*--p.end(), -ps});
        continue;
      }
      if (r == p.begin()) {
        s.erase({*p.begin() - ps, -ps, -*p.begin()});
        continue;
      }
        auto l = r;
        l--;
        int tl = *l, tr = *r;
        s.erase({ps - tl, -tl, -ps});
        s.erase({tr - ps, -ps, -tr});
        s.insert({tr - tl, -tl, -tr});
      }else {
        if (p.empty()) {
          cout << 1 << '\n';
          val[cnt++] = 1;
          p.insert(1);
          continue;
        }
        if (s.empty()) {
           ll x = *p.begin();
           if (x - 1 >= n - x) {
             cout << 1 << '\n';
             val[cnt++] = 1;
             p.insert(1);
             s.insert({x - 1, -1, -x});
             continue;
           }
           cout << n << '\n';
           val[cnt++] = n;
           p.insert(n);
           s.insert({n - x, -x, -n});
           continue;
        }
        array<ll, 3> x = (*--s.end());   
        x[1] *= -1, x[2] *= -1;
        ll a = *p.begin(), b = *--p.end();
        ll v1 = a - 1;
        ll ps = (x[1] + x[2]) / 2;
        ll v2 = ps - x[1];
        ll v3 = n - b;
        if (v1 >= v2 && v1 >= v3) {
            cout << 1 << '\n';
           val[cnt++] = 1;
           s.insert({a - 1, -1, -a});
           p.insert(1);
           continue;
        }
        if (v2 >= v3) {
            cout << ps << '\n';
           val[cnt++] = ps;
           s.erase({x[0], -x[1], -x[2]});
          s.insert({ps - x[1], -x[1], -ps});
          s.insert({x[2] - ps, -ps, -x[2]});
          p.insert(ps);
           continue;
        }  
        cout << n << '\n';
        val[cnt++] = n;
        s.insert({n - b, -b, -n});
        p.insert(n);
      }
  }
}
