#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using ordered_set = tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long

struct cmp {
	bool operator()(pair<int, int> a, pair<int, int> b) const {
		if (a.first == b.first) return a.second < b.second;
		return a.first > b.first;
	};
};

signed main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
#endif

	int n, q;
	cin >> n >> q;

	set<pair<int, int>, cmp> segs;

	ordered_set poses;

	function<void(int, int)> add = [&](int p1, int p2) {
		ll dist = (p2 - p1) / 2;
		if (dist == 0) return;
		segs.insert({dist, p1 + dist});
		segs.insert({dist, p2 - dist});
	};

	function<void(int, int)> remove = [&](int p1, int p2) {
		ll dist = (p2 - p1) / 2;
		if (dist == 0) return;
		segs.erase({dist, p1 + dist});
		segs.erase({dist, p2 - dist});
	};

	vector<int> order;
	while (q--) {
		char t;
		cin >> t;

		if (t == '+') {
			int pos;
			if (segs.empty()) {
				cout << 1 << "\n";
				pos = 1;
				poses.insert(1);
			} else {
				cout << segs.begin()->second << "\n";
				pos = segs.begin()->second;
				poses.insert(segs.begin()->second);
			}
			order.push_back(pos);

			int index = poses.order_of_key(pos);
			if (index == 0) {
				if (pos != 1) segs.insert({pos - 1, 1});
				if (poses.size() > 1) {
					int nxt = *poses.find_by_order(index + 1);
					if (nxt != 1) segs.erase({nxt - 1, 1});
					add(pos, nxt);
				}
			}
			if (index == poses.size() - 1) {
				if (pos != n) segs.insert({n - pos, n});
				if (poses.size() > 1) {
					int prev = *poses.find_by_order(index - 1);
					if (prev != n) segs.erase({n - prev, n});
					add(prev, pos);
				}
			}
			if (index > 0 && index < poses.size() - 1) {
				int p1 = *poses.find_by_order(index - 1);
				int p2 = *poses.find_by_order(index + 1);
				remove(p1, p2);
				add(p1, pos);
				add(pos, p2);
			}
		} else {
			int x;
			cin >> x;
			int pos = order[x - 1];

			int index = poses.order_of_key(pos);
			if (index == 0) {
				if (pos != 1) segs.erase({pos - 1, 1});
				if (poses.size() > 1) {
					int nxt = *poses.find_by_order(index + 1);
					if (nxt != 1) segs.insert({nxt - 1, 1});
				}
			}
			if (index == poses.size() - 1) {
				if (pos != n) segs.erase({n - pos, n});
				if (poses.size() > 1) {
					int prev = *poses.find_by_order(index - 1);
					if (prev != n) segs.insert({n - prev, n});
				}
			}
			if (index > 0 && index < poses.size() - 1) {
				int p1 = *poses.find_by_order(index - 1);
				int p2 = *poses.find_by_order(index + 1);
				remove(p1, pos);
				remove(pos, p2);
				add(p1, p2);
			}
			poses.erase(pos);
		}
	}
}