#include <bits/stdc++.h>
using namespace std;
template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
bool sortbysec(const long long &a, const long long &b) {
  return abs(a) > abs(b);
}
struct cmp {
  bool operator()(const pair<int, int> &a, const pair<int, int> &b) const {
    int lena = a.second - a.first + 1;
    int lenb = b.second - b.first + 1;
    if (lena == lenb) return a.first < b.first;
    return lena > lenb;
  }
};
struct c_h {
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    x ^= FIXED_RANDOM;
    return x ^ (x >> 16);
  }
};
long long calcpow(long long x, long long y) {
  long long temp;
  if (y == 0) return 1;
  temp = calcpow(x, y / 2);
  if (y % 2 == 0)
    return temp * temp;
  else {
    if (y > 0)
      return x * temp * temp;
    else
      return (temp * temp) / x;
  }
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1;
  long long y1;
  long long g = egcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return g;
}
bool isprime(long long a) {
  bool flag = 1;
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) {
      flag = 0;
      break;
    }
  }
  return flag;
}
long long dx8[8] = {1, 0, -1, 0, 1, -1, 1, -1};
long long dy8[8] = {0, 1, 0, -1, 1, -1, -1, 1};
long long dx4[4] = {0, 0, 1, -1};
long long dy4[4] = {1, -1, 0, 0};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, q;
  cin >> n >> q;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  multiset<long long, greater<long long> > s;
  set<long long> si;
  for (long long i = 0; i < n; i++) {
    si.insert(a[i]);
  }
  sort(a.begin(), a.end());
  for (long long i = 0; i < n - 1; i++) s.insert(a[i + 1] - a[i]);
  if (s.size() > 0)
    cout << (*--si.end() - *si.begin()) - *s.begin() << endl;
  else
    cout << "0 \n";
  for (long long i = 0; i < q; i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 1) {
      si.insert(y);
      auto it = si.find(y);
      auto it1 = it;
      auto it2 = it;
      it1--;
      it2++;
      if (it != si.begin()) s.insert(y - *it1);
      if (it2 != si.end()) s.insert(*it2 - y);
      if (it != si.begin() && it2 != si.end()) {
        s.erase(s.find(*it2 - *it1));
      }
    } else {
      auto it = si.find(y);
      auto it1 = it;
      auto it2 = it;
      it1--;
      it2++;
      if (it != si.begin()) s.erase(s.find(y - *it1));
      if (it2 != si.end()) s.erase(s.find(*it2 - y));
      if (it != si.begin() && it2 != si.end()) {
        s.insert((*it2 - *it1));
      }
      si.erase(y);
    }
    if (s.size() == 0 || si.size() == 1)
      cout << "0 \n";
    else {
      cout << (*--si.end() - *si.begin()) - *s.begin() << endl;
    }
  }
  return 0;
}
