#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
typedef long long ll;

int ww[110], ID[110];
int W, Q;

int check(int w, int id) {
    for (int i = 0; i < W; i++) {
        int j;
        for (j = 0; j < w; j++) {
            if (i+j >= W || ww[i+j] != -1) break;
        }
        if (j == w) {
            for (j = 0; j < w; j++) {
                ww[i+j] = id;
            }
            return i;
        }
    }
    return -1;
}

void remove(int id) {
    int w = ID[id];
    int i;
    for (i = 0; i < W; i++) {
        if (ww[i] == id) break;
    }
    for (int j = 0; j < w; j++) {
        ww[i+j] = -1;
    }
}

int main(void) {
    while (1) {
        cin >> W >> Q;
        if (W == 0 && Q == 0) break;
        for (int i = 0; i < W; i++) ww[i] = -1;
        for (int i = 0; i < Q; i++) {
            char c;
            cin >> c;
            if (c == 's') {
                int id, w;
                cin >> id >> w;
                ID[id] = w;
                int ans = check(w, id);
                if (ans == -1) cout << "impossible" << endl;
                else cout << ans << endl;
            } else {
                int id;
                cin >> id;
                remove(id);
            }
        }
        cout << "END" << endl;
    }
    return 0;
}