#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int w,q;
	while(cin >> w >> q && !(w == 0 && q == 0)){
		char kind;
		int id,wide;

		int place[100];
		fill(place,place+100,-1);
		for(int i = 0; i < q; i++){
			cin >> kind;
			if(kind == 's'){
				cin >> id >> wide;
				bool isSpleepable=false;
				for(int j = 0; j+wide-1 < w; j++){
					bool f=false;
					for(int k = 0; k < wide; k++){
						if(place[j+k]!=-1){
							f=true;
							break;
						}
					}
					if(f){
						continue;
					}
					else{
						isSpleepable=true;
						// ツ配ツ療アツづーツ青カツづ淞づゥ
						for(int k = 0; k < wide; k++){
							place[j+k]=id;
						}
						cout << j << endl;
						break;
					}
				}
				if(!isSpleepable){
					cout << "impossible" << endl;
				}
			}
			else{
				cin >> id;
				for(int j = 0; ;j++){
					if(place[j]==id){
						while(place[j]==id){
							place[j]=-1;
							j++;
						}
						break;
					}
				}
			}
		}
		cout << "END" << endl;
	}
	

	return 0;
}