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

ll n;

ll find_dist(ll l, ll r) {
	if (l == 1) {
		return r;
	}
	if (r == n) {
		return n - l + 1;
	}
	ll m = (l + r) / 2;
	return m - l + 1;
}

ll find_place(ll l, ll r) {
	if (l == 1) return 1;
	if (r == n) return n;
	return (l + r) / 2;
}

struct cmp_dist {
	bool operator()(pair<ll, ll> a, pair<ll, ll> b) const {
		ll d1 = find_dist(a.first, a.second);
		ll d2 = find_dist(b.first, b.second);
		if (d1 != d2) return d1 < d2;
		return a.first < b.first;
	}
};

int main() {
	int k;
	cin >> n >> k;
	set<pair<int, int>, cmp_dist> by_dist;
	set<pair<int, int>> by_pos;
	vector<ll> places;
	by_dist.emplace(1, n);
	by_pos.emplace(1, n);
	for (int i = 0; i < k; i++) {
		char c;
		cin >> c;
		if (c == '+') {
			auto [l, r] = *by_dist.begin();
			by_dist.erase(by_dist.begin());
			by_pos.erase({l, r});
			ll x = find_place(l, r);
			cout << x << "\n";
			places.push_back(x);
			if (l != x) {
				by_dist.emplace(l, x-1);
				by_pos.emplace(l, x-1);
			}
			if (x != r) {
				by_pos.emplace(x+1, r);
				by_dist.emplace(x+1, r);
			}
		}
		else {
			ll x;
			cin >> x;
			x = places[x-1];
			ll ln, rn;
			auto right_it = by_pos.lower_bound({x+1, 0});
			vector<pair<ll, ll>> deleting;
			if (right_it != by_pos.end() && right_it->first == x + 1) {
				rn = right_it->second;
				deleting.push_back(*right_it);
			}
			else {
				rn = x;
			}
			if (right_it != by_pos.begin() && (--right_it)->second == x - 1) {
				ln = right_it->first;
				deleting.push_back(*right_it);
			}
			else {
				ln = x;
			}
			for (auto [l, r]: deleting) {
				by_pos.erase({l, r});
				by_dist.erase({l, r});
			}
			deleting.clear();
			by_pos.emplace(ln, rn);
			by_dist.emplace(ln, rn);
		}
	}
}