#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return x * flag;
}
struct seg {
  int mx[800001];
  void modify(int rt, int l, int r, int p, int v) {
    if (l == r) {
      mx[rt] = v;
      return;
    }
    int mid = l + r >> 1;
    if (p <= mid)
      modify(rt << 1, l, mid, p, v);
    else
      modify(rt << 1 | 1, mid + 1, r, p, v);
    mx[rt] = max(mx[rt << 1], mx[rt << 1 | 1]);
  }
  int query(int rt, int l, int r, int L, int R) {
    if (L <= l && r <= R) {
      return mx[rt];
    }
    int mid = l + r >> 1, res = 0;
    if (L <= mid) res = max(res, query(rt << 1, l, mid, L, R));
    if (R > mid) res = max(res, query(rt << 1 | 1, mid + 1, r, L, R));
    return res;
  }
};
set<int> st;
seg t1, t2;
int n, q;
int pos[800001], h[800001], a[800001];
int main() {
  n = read(), q = read();
  int tot = 2e5;
  int m = tot + 10005;
  while (q--) {
    int op = read();
    if (op == 1) {
      int P = read(), H = read() + tot;
      st.insert(P);
      pos[H] = P;
      h[P] = H;
      for (int i = H; i >= H - 9; --i) {
        if (!pos[i]) continue;
        t1.modify(1, 1, n, pos[i], 0);
        t2.modify(1, 1, m, i, 0);
      }
      for (int i = H; i >= H - 9; --i) {
        if (!pos[i]) continue;
        int res = t1.query(1, 1, n, pos[i] + 1, n) + 1;
        t1.modify(1, 1, n, pos[i], res);
        t2.modify(1, 1, m, i, res);
      }
    } else {
      int num = read();
      set<int>::iterator id = st.begin();
      int cnt = 0;
      while (cnt < num) a[++cnt] = *id, ++id;
      --id;
      st.erase(id);
      for (int i = 1; i <= cnt; ++i) {
        if (!h[a[i]]) continue;
        t1.modify(1, 1, n, a[i], 0);
        t2.modify(1, 1, m, h[a[i]], 0);
      }
      for (int i = cnt - 1; i >= 1; --i) {
        if (!h[a[i]]) continue;
        int res = t2.query(1, 1, m, h[a[i]] + 1, m) + 1;
        t1.modify(1, 1, n, a[i], res);
        t2.modify(1, 1, m, h[a[i]], res);
      }
      pos[h[a[cnt]]] = 0;
      h[a[cnt]] = 0;
    }
    printf("%d\n", t1.mx[1]);
    tot--;
  }
}
