#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
#include<unordered_set>
#include<unordered_map>
#include<queue>
#include<stack>
#include<deque>
using namespace std;
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()

int n, k, m, x;

struct Node {
	int l, r;
	Node() {}
	Node(int _l, int _r) : l(_l), r(_r) {}
	bool operator<(const Node& other) const {
		if (r < l) return false;
		if (other.r < other.l) return true;
		int len1 = (r - l) / 2;
		int len2 = (other.r - other.l) / 2;
		if (l == 1 || r == n) {
			len1 = r - l;
		}
		if (other.l == 1 || other.r == n) {
			len2 = other.r - other.l;
		}
		return  len1 > len2 || (len1 == len2 && l < other.l);
	}
	pair<Node, Node> split() const {
		if (l == 1) {
			return { Node(2, 0), Node(2, r) };
		}
		if (r == n) {
			return{ Node(n, n - 1), Node(l, n - 1)};
		}
		int len = (r - l) / 2;
		int m = l + len;
		return{ Node(l, m - 1), Node(m + 1, r) };
	}
};

void solve() {
	set<Node> seg;
	map<int, pair<int, int>> se;
	vector<int> pos = {-1};
	int cnt = 0;
	Node cur;
	pair<Node, Node> spl;
	char call;
	cin >> n >> k;
	seg.emplace(1, n);
	for (int i = 0; i < k; ++i) {
		cin >> call;
		if (call == '+') {
			cur = *seg.begin();
			seg.erase(seg.begin());
			spl = cur.split();
			m = spl.first.r + 1;
			se[m] = { cur.l, cur.r };
			se[cur.l - 1].second = m - 1;
			se[cur.r + 1].first = m + 1;
			if(spl.first.r >= spl.first.l)
				seg.insert(spl.first);
			if (spl.second.r >= spl.second.l)
				seg.insert(spl.second);
			pos.push_back(m);
			cout << m << '\n';
		}
		else {
			cin >> x;
			m = pos[x];
			pair<int, int> lr = se[m];
			se[lr.first - 1].second = lr.second;
			se[lr.second + 1].first = lr.first;
			seg.emplace(lr.first, lr.second);
		}
	}
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
}