#include<iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <map>
#include <deque>
#define int long long
#define double long double
using ll = long long;
using namespace std;
const int mod = 1e9 + 7;
const int INF = 1e9 + 7;
#define get_time (double)clock() / (double)(CLOCKS_PER_SEC)
#ifndef ONLINE_JUDGE
#define debug(x) //cerr << (#x) << ": " << x << endl;
#else
#define debug(x)
#endif
ll max(ll a, ll b) {
    return (a > b) ? a : b;
}
ll min(ll a, ll b) {
    return (a < b) ? a : b;
}
ll bs_sqrt(ll x) {
    ll left = 0, right = 2000000123;
    while (right > left) {
        ll mid = (left + right) / 2;
        if (mid * mid > x) {
            right = mid;
            continue;
        }
        left = mid + 1;
    }
    return left - 1;
}
int gcd(int a, int b) {
    while (a > 0 && b > 0) {
        int c = a;
        a = b % a;
        b = c;
    }
    return a + b;
}
int bin_pow(int a, int n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        ll t = bin_pow(a, n / 2);
        return (t * t);
    }
    else {
        ll t = bin_pow(a, n - 1);
        return (t * a);
    }
}
int n, q;
int cur_in_metro = 0;
vector<int> metro;
set<int> poses;
set<pair<int, int> > st;
void make_plus() {
    auto p = *(--st.end());
    st.erase(p);
    p.second = -p.second;
    int new_pos = p.second;
    debug(p.second);
    metro[metro.size() - 1] = p.second;
    auto lll = poses.lower_bound(new_pos);
    lll--;
    auto rr = poses.upper_bound(new_pos);
    int l = *lll, r = *rr;
    poses.insert(new_pos);
    if (new_pos - 1 > l) {
        if (l == 0) {
            st.insert({ new_pos - 1, -1 });
        } else {
            int mid = (new_pos + l) / 2;
            st.insert({ mid - l, -mid });
        }
    }
    if (new_pos + 1 < r) {
        if (r == n + 1) {
            st.insert({ n - new_pos, -n });
        } else {
            int mid = (new_pos + r) / 2;
            st.insert({ r - mid, -mid });
        }
    }
}
void deleted(int ind) { 
    debug(ind);
    poses.erase(ind);
    auto lll = poses.lower_bound(ind);
    lll--;
    auto rr = poses.upper_bound(ind);
    int l = *lll, r = *rr;
    debug(l);
    debug(r);
    if (l == 0) {
        st.erase({ ind - 1, -1 });
    } else {
        int mid = (l + ind) / 2;
        st.erase({ ind - l, -mid });
    }
    if (r == n + 1) {
        st.erase({ n - ind, -n });
    } else {
        int mid = (ind + r) / 2;
        st.erase({ r - ind, -mid});
    }
    int mid = (l + r) / 2;
    if (l == 0 && r == n + 1) {
        st.insert({ INF, -1 });
    } else if (l == 0 && r > 0) {
        st.insert({ r - 1, -1 });
    } else if (r == n + 1 && l < n) {
        st.insert({ n - l, -1 });
    } else {
        st.insert({ r - mid, -mid });
    }
}
void solve() {
    int num = 0;
    cin >> n >> q;
    vector<int> ans;
    poses.insert(0);
    poses.insert(n + 1);
    st.insert({ INF, -1 });
    for (int it = 0; it < q; it++) {
        char c; cin >> c;
        if (c == '+') {
            metro.push_back(num);
            make_plus();
            num++;
            cur_in_metro++;
            ans.push_back(metro.back());
        } else {
            int i; cin >> i; i--;
            debug(metro[i]);
            deleted(metro[i]);
            cur_in_metro--;
        }
    }
    for (auto c : ans) cout << c << '\n';
}
signed main() {
    /*
    #ifdef ONLINE_JUDGE
    freopen("game.in", "r", stdin);
    freopen("game.out", "w", stdout);
    #endif
    */
    cout << fixed << setprecision(20);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}