#include<bits/stdc++.h>
#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
using namespace std;
#define int long long
#define F first
#define S second
const int N = 2e5 + 7;

signed main() { 
    ios_base::sync_with_stdio(false);    
    cin.tie(nullptr);
    int n, k;
    cin>>n>>k;
    multiset<int> ver;
    multiset<pair<pair<int, int>, int > > st;
    int cnt = 0, cn = 1;
    vector<int> mp(k + k + 1, 0);
    for(int i = 1; i <= k; i++) {
        char c;
        cin>>c;
        if(c == '+') {
            if(cnt == 0) {
                cout << 1 << '\n';
                mp[cn] = 1;
                ver.insert(1);
            }else if(cnt == 1) {
                int x = *ver.begin();
                if(abs(x - 1) >= abs(x - n)) {
                    cout << 1 << '\n';
                    mp[cn] = 1;
                    ver.insert(1);
                    st.insert({{abs(x - 1) / 2, -1}, x});
                }else {
                    cout << n << '\n';
                    mp[cn] = n;
                    ver.insert(n);
                    st.insert({{abs(x - n) / 2, -x}, n});
                }
            }else {
                pair<pair<int, int>, int > res = *st.rbegin();
                st.erase(st.lower_bound(res));
                int l = -res.F.S, r = res.S;
                int dis = r - l;
                int x = (r - l) / 2 + l;
                int ll = *(--ver.rbegin()), rr = *(++ver.begin());
                if(*ver.begin() != 1) {
                    if(dis / 2 <= (rr - 1) / 2 && (rr - 1) / 2 >= (n - ll) / 2) {
                        cout << 1 << '\n';
                        mp[cn] = 1;
                        ver.insert(1);
                        st.insert({{(rr - 1) / 2, -1}, rr});
                        cnt ++, cn ++;
                        continue;
                    }
                }
                if(*ver.rbegin() != n) {
                    if(dis / 2 < (n - ll) / 2 && (rr - 1) / 2 < (n - ll) / 2) {
                        cout << n << '\n';
                        mp[cn] = n;
                        ver.insert(n);
                        st.insert({{(n - ll) / 2, -ll}, n});
                        cnt ++, cn ++;
                        continue;
                    }
                }
                cout <<  x << '\n';
                mp[cn] = x;
                ver.insert(x);
                st.insert({{(x - l) / 2, -l}, x});
                st.insert({{(r - x) / 2, -x}, r});
            }
            cnt ++, cn ++;
        }else {
            int l;
            cin>>l;
            int j = mp[l];  
            int ll = *(--ver.rbegin()), rr = *(++ver.begin());
            if(j == *ver.begin()) {
                int dis = (rr - j);
                st.erase({{dis / 2, -j}, rr});
                ver.erase(j);
            }
            else if(j == *ver.rbegin()) {
                int dis = (j - ll);
                st.erase({{dis / 2, -ll}, j});
                ver.erase(j);
            }else {
                int l = *(--ver.lower_bound(j)), r = *(++ver.lower_bound(j));
                int disx = j - l, disy = r - j;
                st.erase({{disx / 2, -l}, j});
                st.erase({{disy / 2, -j}, r});
                ver.erase(j);
                st.insert({{(r - l) / 2, -l}, r});
            }
            cnt --;
        }
        // cout << i << ' ' << cnt << '\n';
    }
}

