#include <bits/stdc++.h>
using namespace std;
const int MAXSIZE = 10000020;
int bufpos;
char buf[MAXSIZE];
void init() {
  buf[fread(buf, 1, MAXSIZE, stdin)] = '\0';
  bufpos = 0;
}
int readint() {
  int val = 0;
  for (; !isdigit(buf[bufpos]); bufpos++)
    ;
  for (; isdigit(buf[bufpos]); bufpos++) val = val * 10 + buf[bufpos] - '0';
  return val;
}
char readchar() {
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  return buf[bufpos++];
}
int readstr(char* s) {
  int cur = 0;
  for (; isspace(buf[bufpos]); bufpos++)
    ;
  for (; !isspace(buf[bufpos]); bufpos++) s[cur++] = buf[bufpos];
  s[cur] = '\0';
  return cur;
}
const int maxn = 200022;
struct segtree {
  int n;
  int t[maxn * 4];
  void init(int n) {
    this->n = n;
    memset(t, 0, sizeof(t));
  }
  int p, v;
  void update(int o, int l, int r) {
    if (l == r) {
      t[o] = v;
      return;
    }
    int mid = (l + r) / 2;
    if (p <= mid)
      update(o * 2, l, mid);
    else
      update(o * 2 + 1, mid + 1, r);
    t[o] = max(t[o * 2], t[o * 2 + 1]);
  }
  void update(int p, int v) {
    this->p = p, this->v = v;
    update(1, 1, n);
  }
  int ql, qr;
  int query(int o, int l, int r) {
    if (ql <= l && qr >= r) return t[o];
    int mid = (l + r) / 2, ans = 0;
    if (ql <= mid) ans = max(ans, query(o * 2, l, mid));
    if (qr > mid) ans = max(ans, query(o * 2 + 1, mid + 1, r));
    return ans;
  }
  int query(int l, int r) {
    ql = l, qr = r;
    return query(1, 1, n);
  }
} tx, ty;
int a[maxn], dp[maxn];
int qwq[maxn];
struct query {
  int op, p;
} q[maxn];
set<int> s;
int main() {
  init();
  int n = readint(), m = readint(), mx = m + 10;
  tx.init(n);
  ty.init(mx);
  memset(a, -1, sizeof(a));
  for (int o = 1; o <= m; o++) {
    int op = q[o].op = readint();
    if (op == 1) {
      int p = q[o].p = readint(), h = readint();
      a[p] = h + m - o;
      int cur = 0;
      for (int i = max(o - 10, 1); i <= o; i++) {
        if (q[i].op == 2 || a[q[i].p] == -1 || a[q[i].p] >= a[p]) continue;
        qwq[++cur] = q[i].p;
      }
      qwq[++cur] = p;
      sort(qwq + 1, qwq + cur + 1);
      for (int i = 1; i <= cur; i++)
        if (qwq[i] >= p) tx.update(qwq[i], 0);
      dp[p] = tx.query(p + 1, n) + 1;
      for (int i = cur; i; i--)
        if (qwq[i] <= p)
          for (int j = i + 1; j <= cur; j++)
            if (qwq[j] <= p && a[qwq[i]] < a[qwq[j]])
              dp[qwq[i]] = max(dp[qwq[i]], dp[qwq[j]] + 1);
      for (int i = 1; i <= cur; i++) tx.update(qwq[i], dp[qwq[i]]);
      for (int i = 1; i <= cur; i++)
        if (qwq[i] <= p) ty.update(a[qwq[i]], dp[qwq[i]]);
      s.insert(p);
      printf("%d\n", tx.t[1]);
    } else {
      int x = readint();
      set<int>::iterator it = s.begin();
      for (int i = 1; i < x; i++) qwq[i] = *(it++);
      int p = qwq[x] = *it;
      s.erase(it);
      for (int i = 1; i <= x; i++) ty.update(a[qwq[i]], 0);
      dp[qwq[x]] = 0;
      for (int i = x - 1; i >= 1; i--) {
        dp[qwq[i]] = ty.query(a[qwq[i]] + 1, mx) + 1;
        ty.update(a[qwq[i]], dp[qwq[i]]);
      }
      for (int i = 1; i <= x; i++) tx.update(qwq[i], dp[qwq[i]]);
      a[p] = -1;
      printf("%d\n", tx.t[1]);
    }
  }
}
