#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define endl '\n'
#define fr first
#define sc second
#define ld long double
 
template <typename _T>
bool chmin(_T &a, const _T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <typename _T>
bool chmax(_T &a, const _T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
 
const int mod = 998244353;
const int MOD = 1e9 + 7;
const int inf = 1e9 + 7;
const int INF = 1e18 + 7;
const double eps = 1e-6;
const double EPS = 1e-9;
const int N = 2e5 + 5 ;
 
int n , m , sz , cur ;
set <pair <int , pair <int , int>>>  st ;
map <int , int> mpl , mpr ;
int a[N] ;
 
void solve() {
  cin >> n >> m ;
  st.insert({(-n+1)/2,{1,n}}) ;
  mpl[1] = n ; mpr[n] = 1 ;
  for ( int i = 0 ; i < m; i ++ ){
    //cout << i<< ": \n" ;
    //for ( auto j : st ) cout << j.ff << ' ' << j.ss.ff << ' ' << j.ss.ss << endl ; 
    char t ;
    cin >> t ;
    if ( t == '+' ){
      auto it = *st.begin() ;
      st.erase(st.begin()) ;
      sz ++ ;
      int l = it.ss.ff , r = it.ss.ss ;
      if ( l == 1 ){
        cout << "1\n" ;
        a[sz] = 1 ; mpl[1] = 0 ; mpr[1] = 0 ;
        if ( r == l ) continue ;
        st.insert({-(r-2)/2,{2,r}}) ;
        mpl[1] = 0 ;
        mpl[2] = r ;
        mpr[r] = 2 ;
        continue ;
      }
      if ( r == n ){
        cout << n << "\n" ; 
        a[sz] = n ; mpl[n] = 0 ; mpr[n] = 0 ;
        if ( l == r ) continue ;
        st.insert({-(n-l-1)/2,{l,n-1}}) ;
        mpr[n] = 0 ;
        mpl[l] = n-1 ;
        mpr[n-1] = l ;
        continue ;
      }
      int mid = (l+r)/2 ;
      cout << mid << endl ;
      a[sz] = mid ; mpl[mid] = 0 ; mpr[mid] = 0 ;
      if (l<mid) st.insert({-(mid-l-1)/2,{l,mid-1}}) , mpl[l] = mid-1 , mpr[mid-1] = l , mpr[r] = 0 ;
      if (r>mid) st.insert({-(r-mid-1)/2,{mid+1,r}}) , mpl[mid+1] = r , mpr[r] = mid+1 , mpl[l] = ((l<mid)?mpl[l]:-1) ;
    }
    else{
      int x ; cin >> x ;
      x = a[x] ;
      int l = mpr[x-1] , r = mpl[x+1] ;
      if ( l == 0 && r == 0 ){
        mpl[x] = x ;
        mpr[x] = x ;
        st.insert({0,{x,x}}) ;
        continue ;
      }
      if ( l == 0 ){
        st.erase({(-r+x-1)/2,{x+1,r}}) ;
        st.insert({-(r-x)/2,{x,r}}) ;
        mpl[x+1] = 0 ;
        mpl[x] = r ;
        mpr[r] = x;
        continue ;
      }
      if ( r == 0 ){
        st.erase({-(x-l-1)/2,{l,x-1}}) ;
        st.insert({-(x-l)/2,{l,x}}) ;
        mpr[x-1] = 0 ;
        mpr[x] = l;
        mpl[l] = x;
        continue ;
      }
      st.erase({-(r-x-1)/2,{x+1,r}}) ; 
      st.erase({-(x-l-1)/2,{l,x-1}}) ;
      st.insert({-(r-l)/2,{l,r}}) ;
      mpl[x+1] = 0 , mpr[x-1] = 0 , mpl[l] = r, mpr[r] = l;
    }
  }
}
 
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int tt = 1;
  //cin >> tt;
  while(tt--) {
    solve();
  }
}
