#ifdef LOCAL
    #define _GLIBCXX_DEBUG
#endif // LOCAL

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <unordered_set>
#include <bitset>
#include <queue>
#include <iomanip>
#include <iterator>
#include <fstream>
#include <cstdlib>
#include <random>
#include <climits>
#include <chrono>

using namespace std;

//#define int long long
#define f first
#define s second
#define fi first
#define se second
#define p_b push_back
#define e_b emplace_back
#define pw(x) (1LL<<((int)x))
#define sz(x) (ll)x.size()
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()

using ll = long long;
using ul = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;

const ll N = 2e5 + 5, mod = 1e9+7;

template<class T> inline T sqr(T x) {return x * x;}
template<class T> inline void amin(T &a, T b) {a = a < b ? a : b;}
template<class T> inline void amax(T &a, T b) {a = a > b ? a : b;}
template<class T> inline void smod(T &a, T b) {a = a + b >= mod ? a + b - mod : a + b;}
template<class T> inline void dmod(T &a, T b) {a = a - b >= 0 ? a - b : a - b + mod;}

mt19937 rnd(time(0));

ll n, pos[N];
unordered_map<ll, pll> here;
set<array<ll, 3>> segs;

inline ll get_len(ll l, ll r) {
    ll len = (r - l + 1);
    if (l != 1 && r != n) {
        len = (len + 1) / 2;
    }
    return len;
}

void del(ll x) {
    ll l = x, r = x, len, L, R;
    if (x != 1) {
        L = here[x - 1].f, R = here[x - 1].s;
        if (L != -1) {
            len = get_len(L, R);
            segs.erase(segs.find({len, L, R}));
            l = L;
        }
    }
    if (x != n) {
        L = here[x + 1].f, R = here[x + 1].s;
        if (L != -1) {
            len = get_len(L, R);
            segs.erase(segs.find({len, L, R}));
            r = R;
        }
    }
    len = get_len(l, r);
    here[l] = here[r] = {l, r};
    segs.insert({len, l, r});
}

ll add() {
//    for (auto [a, b, c] : segs)
//        cout << a << ' ' << b << ' ' << c << '\n';
    auto [len, l, r] = *segs.begin();
    segs.erase(segs.begin());
    ll cur = (l + r) / 2;
    if (l == 1)
        cur = 1;
    else if (r == n)
        cur = n;
    here[cur] = here[l] = here[r] = {-1, -1};
    if (cur != l) {
        len = get_len(l, cur - 1);
        here[cur - 1] = here[l] = {l, cur - 1}, segs.insert({len, l, cur - 1});
    }
    if (cur != r) {
        len = get_len(cur + 1, r);
        here[cur + 1] = here[r] = {cur + 1, r}, segs.insert({len, cur + 1, r});
    }
    return cur;
}

void solve() {
    int q;
    cin >> n >> q;
    segs.insert({n, 1, n});
    here[1] = here[n] = {1, n};
    int nw = 1;
    for (int i = 1; i <= q; i++) {
        char type;
        cin >> type;
        if (type == '+') {
            pos[nw] = add();
            cout << pos[nw++] << '\n';
        } else {
            ll x;
            cin >> x;
//            cout << pos[x] << '\n';
            del(pos[x]);
        }
    }
}

int main() {
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #else
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
    #endif // LOCAL
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
    #ifdef LOCAL
        cout << "\n\n===\nTime : " << (long double)clock() / CLOCKS_PER_SEC << '\n';
    #endif // LOCAL
}
