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

#define ll long long
#define int long long
const int N = 2e5;
int n, q;
ll cm[N], f[N], s[N];
set<pair<ll, pair<ll, ll>>> st;
set<ll> t;
ll col = 0, cf = 0;
void add(ll f)
{
    if (*t.rbegin() > f && *t.begin() < f)
    {
        auto it = t.upper_bound(f);
        auto it1 = t.upper_bound(f);
        it1--;
        st.insert({f - *it1, {-*it1, -f}});
        st.insert({*it - f, {-f, -*it}});
        st.erase({*it - *it1, {-*it1, -*it}});
    }
    else 
    {
        if (*t.rbegin() > f)
        {
            auto it = t.upper_bound(f);
            st.insert({*it - f, {-f, -*it}});
        }
        else if (*t.begin() < f)
        {
            auto it1 = t.upper_bound(f);
            it1--;
            st.insert({f - *it1, {-*it1, -f}});
        }
    }
    cm[cf + 1] = f;
    t.insert(f);
}
ll val(ll f)
{
    if (t.find(f) != t.end())
        return 1e18 + 100;
    ll ans = 1e18 + 100;
    if (*t.rbegin() > f)
    {
        auto it = t.upper_bound(f);
        ans = min(ans,*it - f);
    }
    if (*t.begin() < f)
    {
        auto it1 = t.upper_bound(f);
        it1--;
        ans = min(ans,f - *it1);
    }
    return ans;
}
main()
{
    
    cin >> n >> q;
    for (int i = 1; i <= q; i++)
    {
        char tp;
        cin >> tp;
        if (tp == '+')
        {
            if (!col)
            {
                cout << 1 << '\n';
                cm[cf + 1] = 1;
                t.insert(1);
            }
            else if (col == 1)
            {
                int pos = (*t.begin());
                if (n - pos > pos - 1)
                {
                    cm[cf + 1] = n;
                    t.insert(n);
                    st.insert({n - pos, {-pos, -n}});
                    cout << n << '\n';
                }
                else
                {
                    cout << 1 << '\n';
                    cm[cf + 1] = 1;
                    t.insert(1);
                    st.insert({pos - 1, {-1, -pos}});
                }
            }
            else
            {
                auto [x, y] = (*st.rbegin());
                ll pos = (-y.first - y.second) >> 1;
                vector<pair<ll, ll>> gg;
                gg.push_back({val(pos), pos});
                gg.push_back({val(n), n});
                gg.push_back({val(1), 1});
                sort(gg.begin(),gg.end());
                cout << gg[0].second << '\n';
                add(gg[0].second);
            }
            col++;
            cf++;
        }
        else
        {
            ll f;
            cin >> f;
            f = cm[f];
            t.erase(f);
            col--;
            if (col == 0)
                continue;
            if (*t.rbegin() > f && *t.begin() < f)
            {
                auto it = t.upper_bound(f);
                auto it1 = t.upper_bound(f);
                it1--;
                st.erase({f - *it1, {-*it1, -f}});
                st.erase({*it - f, {-f, -*it}});
                st.insert({*it - *it1, {-*it1, -*it}});
            }
            else
            {
                if (*t.rbegin() > f)
                {
                    auto it = t.upper_bound(f);
                    st.erase({*it - f, {-f, -*it}});
                }
                else if (*t.begin() < f)
                {
                    auto it1 = t.upper_bound(f);
                    it1--;
                    st.erase({f - *it1, {-*it1, -f}});
                }
            }
        }
    }
}