#include <bits/stdc++.h>
using namespace std;
const int N = 200055;
int n, m, p[N], h[N];
struct SegmentTree {
  int dp[N];
  struct TNode {
    int l, r, mx;
  } t[N << 2];
  inline int lc(int pos) { return pos << 1; }
  inline int rc(int pos) { return pos << 1 | 1; }
  inline void pushup(int pos) { t[pos].mx = max(t[lc(pos)].mx, t[rc(pos)].mx); }
  void build(int pos, int l, int r) {
    t[pos].l = l;
    t[pos].r = r;
    if (l == r) return;
    int mid = (l + r) >> 1;
    build(lc(pos), l, mid);
    build(rc(pos), mid + 1, r);
  }
  void modify(int pos, int p, int v) {
    if (t[pos].l == t[pos].r) {
      t[pos].mx = v;
      return;
    }
    int mid = (t[pos].l + t[pos].r) >> 1;
    if (p <= mid)
      modify(lc(pos), p, v);
    else
      modify(rc(pos), p, v);
    pushup(pos);
  }
  int query(int pos, int p) {
    if (t[pos].r <= p) return t[pos].mx;
    int mid = (t[pos].l + t[pos].r) >> 1;
    if (mid < p) return max(query(lc(pos), p), query(rc(pos), p));
    return query(lc(pos), p);
  }
  inline void ins(int pos) { modify(1, pos, dp[pos] = query(1, pos - 1) + 1); }
} tp, th;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  set<int> st;
  tp.build(1, 0, n);
  th.build(1, 0, m + 10);
  for (int t = 1; t <= m; t++) {
    int op;
    cin >> op;
    if (op == 1) {
      int pp, ht;
      cin >> pp >> ht;
      pp = n - pp + 1;
      ht = t + 10 - ht;
      p[ht] = pp;
      h[pp] = ht;
      st.insert(pp);
      for (int i = ht + 1; i < ht + 10; i++)
        if (p[i]) tp.modify(1, p[i], 0);
      for (int i = ht; i < ht + 10; i++)
        if (p[i])
          tp.ins(p[i]), th.dp[i] = tp.dp[p[i]], th.modify(1, i, th.dp[i]);
      cout << tp.t[1].mx << endl;
    } else {
      int kk;
      cin >> kk;
      auto it = st.end();
      while (kk--) --it, th.modify(1, h[*it], 0);
      tp.modify(1, *it, 0);
      p[h[*it]] = 0;
      for (st.erase(it++); it != st.end(); ++it) {
        th.ins(h[*it]);
        tp.dp[*it] = th.dp[h[*it]];
        tp.modify(1, *it, tp.dp[*it]);
      }
      cout << tp.t[1].mx << endl;
    }
  }
  return 0;
}
