#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
namespace fast_IO {
const int MAXSIZE = 1 << 20;
char buf[MAXSIZE], *p1, *p2;
template <typename T>
inline void read(T &x) {
  x = 0;
  bool sign = false;
  char ch =
      (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2)
           ? EOF
           : *p1++);
  while (ch < '0' || '9' < ch) {
    sign |= ch == '-';
    ch =
        (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  while ('0' <= ch && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch =
        (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  x = sign ? -x : x;
}
char pbuf[MAXSIZE], *pp = pbuf;
inline void push(const char &c) {
  if (pp - pbuf == MAXSIZE) {
    fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
  }
  *pp++ = c;
}
inline void lastprint() { fwrite(pbuf, 1, pp - pbuf, stdout); }
template <typename T>
inline void print(T x, char ch) {
  static char outp[128];
  int tot = 0;
  if (!x) {
    push('0');
    push(ch);
    return;
  } else if (x < 0) {
    x = -x;
    push('-');
  }
  while (x) {
    outp[tot++] = x % 10, x /= 10;
  }
  while (tot) {
    push(outp[--tot] + 48);
  }
  push(ch);
}
}  // namespace fast_IO
const int MAXN = 2e5 + 100;
const int SIZE = (1 << 19) + 50;
struct Segment_tree {
  struct Node {
    int stdl, stdr, val;
    Node() : stdl(0), stdr(0), val(0) {}
  } tree[SIZE];
  inline void buildtree(int root, int l, int r) {
    tree[root].stdl = l;
    tree[root].stdr = r;
    if (l == r) return;
    buildtree((root << 1), l, ((tree[root].stdl + tree[root].stdr) >> 1));
    buildtree((root << 1 | 1), ((tree[root].stdl + tree[root].stdr) >> 1) + 1,
              r);
  }
  inline void update(int root) {
    if (tree[root].stdl != tree[root].stdr) {
      tree[root].val = max(tree[(root << 1)].val, tree[(root << 1 | 1)].val);
    }
  }
  inline void replace(int root, int pos, int val) {
    if (tree[root].stdl == tree[root].stdr) {
      tree[root].val = val;
      return;
    }
    if (pos <= ((tree[root].stdl + tree[root].stdr) >> 1))
      replace((root << 1), pos, val);
    else
      replace((root << 1 | 1), pos, val);
    update(root);
  }
  inline int query(int root, int l, int r) {
    if (l <= tree[root].stdl && tree[root].stdr <= r) {
      return tree[root].val;
    }
    int res = 0;
    if (l <= ((tree[root].stdl + tree[root].stdr) >> 1))
      res = max(res, query((root << 1), l, r));
    if (r > ((tree[root].stdl + tree[root].stdr) >> 1))
      res = max(res, query((root << 1 | 1), l, r));
    return res;
  }
} TreeX, TreeY;
int pos[MAXN], height[MAXN], dp[MAXN];
set<int> allpos;
using namespace fast_IO;
int main() {
  int n, m;
  read(n), read(m);
  TreeX.buildtree(1, 1, n);
  TreeY.buildtree(1, 1, m + 20);
  for (register int i = (1); i <= (m); ++i) {
    int type, a, b;
    read(type);
    if (type == 1) {
      read(a), read(b);
      b = b + m - i;
      pos[a] = b;
      height[b] = a;
      allpos.insert(a);
      vector<int> low;
      for (register int i = (b); i >= (b - 10); --i) {
        if (i < 0) break;
        if (height[i]) {
          low.push_back(height[i]);
          TreeX.replace(1, height[i], 0);
        }
      }
      for (auto pt : low) {
        dp[pt] = (pt < n ? TreeX.query(1, pt + 1, n) : 0) + 1;
        TreeX.replace(1, pt, dp[pt]), TreeY.replace(1, pos[pt], dp[pt]);
      }
      print(TreeX.query(1, 1, n), '\n');
    } else {
      read(a);
      vector<int> bef;
      auto it = allpos.begin();
      for (register int i = (1); i <= (a); ++i) {
        if (pos[*it]) {
          TreeY.replace(1, pos[*it], 0);
          bef.push_back(*it);
          ++it;
        }
      }
      a = bef.back();
      bef.pop_back();
      allpos.erase(a);
      TreeX.replace(1, a, 0);
      TreeY.replace(1, pos[a], 0);
      height[pos[a]] = 0, pos[a] = 0;
      reverse((bef).begin(), (bef).end());
      for (auto pt : bef) {
        dp[pt] = TreeY.query(1, pos[pt] + 1, m + 20) + 1;
        TreeX.replace(1, pt, dp[pt]), TreeY.replace(1, pos[pt], dp[pt]);
      }
      print(TreeX.query(1, 1, n), '\n');
    }
  }
  lastprint();
  return 0;
}
