#include <bits/stdc++.h>
#define int long long
using namespace std;

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

const int inf = 1e9;
const ll infll = 1e18;
ll N;
struct Range {
    ll l, r;
    bool operator <(const Range &other)
    const
    {
        ll k1 = r - l;
        ll k2 = other.r - other.l;
        if (k1 == k2 || (abs(k1 - k2) == 1 && max(k1, k2) % 2 != 0 && l != 1 && other.l != 1 && r != N && other.r != N)) {
            return l < other.l;
        }
        return (k1 > k2);
    }
};

bool comp(Range a, Range b) {
    ll k1 = a.r - a.l;
    ll k2 = b.r - b.l;
    if (a.r - a.l == b.r - b.l || (abs(k1 - k2) == 1 && max(k1, k2) % 2 != 0 && a.l != 1 && b.l != 1 && a.r != N && b.r != N)) {
        return a.l < b.l;
    }
    return (a.r - a.l > b.r - b.l);
}

struct llp {
    ll x;

    bool operator < (const llp &other) const {
        return x > other.x;
    }
};

void solve() {
    ll n, k;
    cin >> n >> k;
    N = n;
    set<ll> p;
    set<llp> pp;
    set<Range> s;
    p.insert(0);
    p.insert(n + 1);
    pp.insert({0});
    pp.insert({n + 1});
    s.insert({1, n});
    vector<ll> a(k);

    int cur = 0;

    while (k--) {
        char c; cin >> c;
        if (c == '+') {
            auto range = *s.begin();
            s.erase(s.begin());

            ll l = range.l, r = range.r;

            ll m = l + (r - l) / 2;

            if (r == n)
                m = r;
            if (l == 1)
                m = l;

            a[cur++] = m;
            p.insert(m);
            pp.insert({m});
            s.insert({l, m - 1});
            s.insert({m + 1, r});
        } else {
            int x; cin >> x, --x;
            ll m = a[x];

            auto itr = p.upper_bound(m);
            auto itl = pp.upper_bound({m});

            ll ml = itl->x;
            ll mr = *itr;

            p.erase(m);
            pp.erase({m});

            if (p.size() == 2) {
                s.erase(s.begin(), s.end());
                s.insert({1, n});
                continue;
            }
            s.erase({ml + 1, m - 1});
            s.erase({m + 1, mr - 1});

            s.insert({ml + 1, mr - 1});
        }
    }

    for (int i = 0; i < cur; ++i)
        cout << a[i] << '\n';
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    //freopen("input.txt", "r", stdin);

    int t = 1;
    //cin >> t;
    while (t--)
        solve();
}
