#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<iomanip>
using namespace std;
using ll = long long;
using db = double;

void solve()
{
	ll n; int k;
	cin >> n >> k;
	set<ll> mes;
	set<tuple<ll, ll, ll>> d;
	mes.insert(0);
	mes.insert(n + 1);
	d.insert({ n,0,n + 1 });
	vector<ll> m(k);
	int cr = 0;
	for (int i = 0; i < k; i++)
	{
		char t;
		cin >> t;
		if (t == '+')
		{
			auto [dist, l, r] = *d.begin();
			d.erase(d.begin());
			ll cur = (r + l) / 2;
			if (l == 0)
			{
				cur = 1;
			}
			else if (r == n + 1)
			{
				cur = n;
			}

			d.insert({ -(cur - l)/2,l,cur });
			d.insert({ -(r - cur)/2,cur,r });
			mes.insert(cur);
			m[cr++] = cur;
			cout << cur << '\n';
		}
		else
		{
			int x;
			cin >> x;
			x--;
			ll cur = m[x];
			auto it = mes.lower_bound(cur);
			ll pr = *prev(it);
			ll nxt = *next(it);
			mes.erase(cur);
			d.erase({ -(cur - pr)/2,pr,cur });
			d.erase({ -(nxt - cur)/2,cur,nxt });
			d.insert({ -(nxt - pr)/2,pr,nxt });
		}
	}
}

int main()
{
	cin.tie(0)->sync_with_stdio(0);
	cout.tie(0)->sync_with_stdio(0);
	int t = 1;
	//cin>>t;
	while (t--) {
		solve();
	}
}