#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 10000000

typedef long long ll;

vector< pair<int, pair<int, int> > > vpi;
bool f[1000];
int W, Q, id, w;
char s;

int main(){
	while (cin >> W >> Q){
		if (W + Q == 0)break;
		REP(i, Q){
			cin >> s;
			if (s == 's'){
				cin >> id >> w;
				int c = 0;
				REP(j, W){
					f[j] ? c = 0 : c++;
					if (c == w){
						cout << j - w + 1 << endl;
						FOR(k, j - w + 1, j + 1){
							f[k] = 1;
						}
						pair<int, pair<int, int> > pi;
						pi.first = id;
						pi.second.first = j - w + 1;
						pi.second.second = j + 1;
						vpi.push_back(pi);
						break;
					}
					if (j == W - 1){
						cout << "impossible\n";
					}
				}
			}
			else{
				cin >> id;
				REP(j, vpi.size()){
					if (vpi[j].first == id){
						FOR(k, vpi[j].second.first, vpi[j].second.second){
							f[k] = 0;
						}
					}
				}
			}
		}
		cout << "END\n";
		vpi.clear();
		REP(i, W){
			f[i] = 0;
		}
	}
}