#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
void qread(int &x) {
  int neg = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = 10 * x + c - '0', c = getchar();
  x *= neg;
}
const int maxn = 300005;
int n, m;
set<int> sx, sy;
int xty[maxn], ytx[maxn];
class Segtree {
 public:
  int sz;
  int t[maxn * 4];
  void init() {
    for (sz = 1; sz <= max(n, 10 + m); sz <<= 1)
      ;
  }
  void upd(int v, int val) {
    v += sz - 1;
    t[v] = val;
    for (v >>= 1; v; v >>= 1) t[v] = max(t[v << 1], t[v << 1 | 1]);
  }
  int qry(int l, int r) {
    int res = 0;
    for (l += sz - 1, r += sz - 1; l <= r; l >>= 1, r >>= 1) {
      if (l & 1) res = max(res, t[l]), l++;
      if ((r + 1) & 1) res = max(res, t[r]), r--;
    }
    return res;
  }
} treex, treey;
int insert(int px, int pval) {
  vector<pair<int, int> > proc;
  sx.insert(px);
  sy.insert(pval);
  xty[px] = pval;
  ytx[pval] = px;
  set<int>::iterator it = sy.begin();
  while (true) {
    int cury = *it;
    int curx = ytx[cury];
    treex.upd(curx, 0);
    treey.upd(cury, 0);
    proc.push_back(make_pair(curx, cury));
    if (cury == pval) break;
    it++;
  }
  for (int i = proc.size() - 1; i >= 0; i--) {
    int curx = proc[i].first, cury = proc[i].second;
    int curval = treex.qry(curx + 1, n) + 1;
    treex.upd(curx, curval);
    treey.upd(cury, curval);
  }
  return treex.qry(1, n);
}
int erase(int pk) {
  vector<pair<int, int> > proc;
  int cnt = 0;
  set<int>::iterator it = sx.begin();
  while (true) {
    int curx = *it;
    int cury = xty[curx];
    treex.upd(curx, 0);
    treey.upd(cury, 0);
    cnt++;
    if (cnt == pk) {
      sx.erase(it);
      sy.erase(sy.find(cury));
      break;
    }
    proc.push_back(make_pair(curx, cury));
    it++;
  }
  for (int i = proc.size() - 1; i >= 0; i--) {
    int curx = proc[i].first, cury = proc[i].second;
    int curval = treey.qry(cury + 1, 10 + m) + 1;
    treex.upd(curx, curval);
    treey.upd(cury, curval);
  }
  return treex.qry(1, n);
}
int main() {
  scanf("%d%d", &n, &m);
  treex.init();
  treey.init();
  for (int(i) = 1; (i) <= m; i++) {
    int op;
    scanf("%d", &op);
    if (op == 1) {
      int px, pval;
      scanf("%d%d", &px, &pval);
      printf("%d\n", insert(px, pval - i + m));
    } else {
      int pk;
      scanf("%d", &pk);
      printf("%d\n", erase(pk));
    }
  }
  return 0;
}
