#include <bits/stdc++.h>

#define _FORTIFY_SOURCE 0
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")

using namespace std;

typedef long long ll;
typedef long double ld;
#define int ll
#define double ld

#ifdef LOCAL
#   define dbg(x) cout << #x " = " << (x) << '\n';
#   define dbgf printf
#else
#   define dbg(x)
#   define dbgf(...)
#endif

#define all(x) std::begin(x), std::end(x)
#define rall(x) std::rbegin(x), std::rend(x)

template<typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &p) {
    return out << p.first << ' ' << p.second;
}

template<typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &p) {
    return in >> p.first >> p.second;
}

//const auto boostIO = []() {
//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    cout.tie(0);
//    cout << fixed;
//    cout.precision(12);
//    return 0;
//} ();

struct seg {
    int d, l, r;
    bool operator < (const seg & oth) const {
        return (this->d > oth.d || (this->d == oth.d && this->l < oth.l));
    }

    void u(const seg & oth) {
        this->l = min(this->l, oth.l);
        this->r = max(this->r, oth.r);
        this->d = this->r - this->l + 1;
    }
};

void solve() {
    int n, k;
    cin >> n >> k;
    set<seg> a;
    a.insert({n, 0, n - 1});
    set<pair<int, int>> lr;
    vector<int> pos;
    while (k--) {
        char c;
        cin >> c;
        if (c == '+') {
            auto s = *a.begin();
            a.erase(s);
            lr.erase({s.l, s.r});
            int ans = 0;
            if (s.l == 0) {
                ans = 0;
                a.insert({s.r, 1, s.r});
//                cout << "NEW SEG: " << 1 << ' ' << s.r << '\n';
                lr.insert({1, s.r});
            }
            else if (s.r == n - 1) {
                ans = n - 1;
                a.insert({s.r, s.l, n - 2});
                lr.insert({s.l, n - 2});
            }
            else {
                int m = s.l + (s.r - s.l) / 2;
                ans = m;
                a.insert({m - s.l, s.l, m - 1});
                lr.insert({s.l, m - 1});
                a.insert({s.r - m, m + 1, s.r});
                lr.insert({m + 1, s.r});
            }
            pos.push_back(ans);
            cout << ans + 1 << '\n';
        }
        else {
            int i;
            cin >> i;
            i--;
//            cout << i << '\n';
            int p = pos[i];
            auto it = lr.lower_bound({p, p});
            seg new_seg = {1, p, p};
            pair<int, int> l = {p, p}, r = {p, p};
            if (it != lr.end() && it->first == p + 1) {
                r = *it;
            }
            if (it != lr.begin() && (--it)->second == p - 1) {
                l = *(--it);
            }
            lr.erase(l);
            lr.erase(r);
//            cout << l << ' ' << r << "TO UN\n ";
            a.erase({l.second - l.first + 1, l.first, l.second});
            a.erase({r.second - r.first + 1, r.first, r.second});
            new_seg.u({l.second - l.first + 1, l.first, l.second});
            new_seg.u({r.second - r.first + 1, r.first, r.second});
            lr.insert({new_seg.l, new_seg.r});
            a.insert(new_seg);
//            cout << "NEW: " << new_seg.l << ' ' << new_seg.r << '\n';
        }
    }
}

signed main() {

    solve();

    return 0;
}