#include <bits/stdc++.h>
using namespace std;
void canhazfast() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
template <typename T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <typename T>
T extgcd(T a, T b, T &x, T &y) {
  T x0 = 1, y0 = 0, x1 = 0, y1 = 1;
  while (b) {
    T q = a / b;
    a %= b;
    swap(a, b);
    x0 -= q * x1;
    swap(x0, x1);
    y0 -= q * y1;
    swap(y0, y1);
  }
  x = x0;
  y = y0;
  return a;
}
int ctz(unsigned x) { return __builtin_ctz(x); }
int ctzll(unsigned long long x) { return __builtin_ctzll(x); }
int clz(unsigned x) { return __builtin_clz(x); }
int clzll(unsigned long long x) { return __builtin_clzll(x); }
int popcnt(unsigned x) { return __builtin_popcount(x); }
int popcntll(unsigned long long x) { return __builtin_popcountll(x); }
int bsr(unsigned x) { return 31 ^ clz(x); }
int bsrll(unsigned long long x) { return 63 ^ clzll(x); }
int main() {
  canhazfast();
  int n, q, sum = 0, res;
  set<int> x;
  multiset<int> ds;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    int p;
    cin >> p;
    x.insert(p);
  }
  for (auto i = x.begin(), j = next(i); j != x.end(); i = j++) {
    int d = (*j) - (*i);
    ds.insert(d);
    sum += d;
  }
  res = sum;
  if (ds.size()) res -= *ds.rbegin();
  cout << res << '\n';
  for (int i = 0; i < q; ++i) {
    int t, p;
    cin >> t >> p;
    if (t) {
      int dn, dp;
      auto nxt = x.upper_bound(p);
      if (nxt != x.end()) {
        dn = (*nxt) - p;
        sum += dn;
        ds.insert(dn);
      }
      if (nxt != x.begin()) {
        auto pre = prev(nxt);
        dp = p - *pre;
        sum += dp;
        ds.insert(dp);
        if (nxt != x.end()) {
          sum -= dn + dp;
          ds.erase(ds.find(dn + dp));
        }
      }
      x.insert(p);
    } else {
      int dn, dp;
      auto cur = x.find(p);
      auto nxt = next(cur);
      if (nxt != x.end()) {
        dn = (*nxt) - p;
        sum -= dn;
        ds.erase(ds.find(dn));
      }
      if (cur != x.begin()) {
        auto pre = prev(cur);
        dp = p - *pre;
        sum -= dp;
        ds.erase(ds.find(dp));
        if (nxt != x.end()) {
          sum += dn + dp;
          ds.insert(dn + dp);
        }
      }
      x.erase(cur);
    }
    res = sum;
    if (ds.size()) res -= *ds.rbegin();
    cout << res << '\n';
  }
  return 0;
}
