#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
template <typename T>
using mxpq = priority_queue<T>;
template <typename T>
using mnpq = priority_queue<T, vector<T>, greater<T>>;
const long long mod = 1e9 + 7;
const long long N = 6e4 + 6;
const long long maxN = 1e5 + 5;
const long long MAX_SIZE = 2e6 + 6;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const double PI = 3.14159265359;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
long long powerM(long long x, long long y, long long M = mod) {
  long long v = 1;
  x = x % M;
  while (y > 0) {
    if (y & 1) v = (v * x) % M;
    y = y >> 1;
    x = (x * x) % M;
  }
  return v;
}
long long power(long long x, long long y) {
  long long v = 1;
  while (y > 0) {
    if (y & 1) v = v * x;
    y = y >> 1;
    x = x * x;
  }
  return v;
}
int n, q;
set<int> s;
multiset<int> ms;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> q;
  int x;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    s.insert(x);
  }
  int prev = 0;
  for (auto it : s) {
    if (prev == 0) {
      prev = it;
    } else {
      ms.insert(it - prev);
      prev = it;
    }
  }
  for (long long i = 0; i < q + 1; i++) {
    if (ms.size() == 0) {
      cout << 0 << '\n';
    } else {
      int maxp = *s.rbegin();
      int minp = *s.begin();
      int bigdiff = *ms.rbegin();
      cout << maxp - minp - bigdiff << '\n';
    }
    if (i == q) return 0;
    cin >> x;
    if (x == 0) {
      cin >> x;
      auto it1 = s.find(x);
      auto it2 = it1;
      it2++;
      auto it3 = it1;
      it3--;
      if (it2 != s.end()) {
        int diff = *it2 - x;
        ms.erase(ms.find(diff));
      }
      if (it1 != s.begin()) {
        int diff = x - *it3;
        ms.erase(ms.find(diff));
      }
      if ((it1 != s.begin()) && (it2 != s.end())) {
        ms.insert(*it2 - *it3);
      }
      s.erase(x);
    } else {
      cin >> x;
      s.insert(x);
      auto it1 = s.find(x);
      auto it2 = it1;
      it2++;
      auto it3 = it1;
      it3--;
      if (it1 == s.begin() && it2 != s.end()) {
        ms.insert(*it2 - x);
      } else if (it2 == s.end() && it1 != s.begin()) {
        ms.insert(x - *it3);
      } else if (it1 != s.begin() && it2 != s.end()) {
        ms.erase(ms.find(*it2 - *it3));
        ms.insert(x - *it3);
        ms.insert(*it2 - x);
      }
    }
  }
  return 0;
}
