#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  long long res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long fermat_inv(long long y) { return power(y, 1000000007 - 2); }
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    int n, q;
    cin >> n >> q;
    set<int> s;
    for (int i = 0; i < n; i++) {
      int a;
      cin >> a;
      s.insert(a);
    }
    map<long long, int> m;
    for (auto it = s.begin(); it != s.end();) {
      int val = *it;
      val = -val;
      it++;
      if (it == s.end()) break;
      val += (*it);
      m[val]++;
    }
    auto it = m.end();
    if (it == m.begin())
      cout << "0\n";
    else {
      auto it1 = s.begin();
      auto it2 = s.end();
      it2--;
      long long ans = (*it2) - (*it1);
      it--;
      ans -= it->first;
      cout << ans << "\n";
    }
    while (q--) {
      int ty, x;
      cin >> ty >> x;
      if (ty == 0) {
        auto it = s.lower_bound(x);
        int ctr = 0;
        long long val1 = 0;
        if (it != s.begin()) {
          it--;
          long long val = x - (*it);
          val1 += val;
          ctr++;
          m[val]--;
          if (m[val] == 0) m.erase(val);
        }
        auto it1 = s.upper_bound(x);
        if (it1 != s.end()) {
          long long val = (*it1) - x;
          m[val]--;
          ctr++;
          val1 += val;
          if (m[val] == 0) m.erase(val);
        }
        if (ctr == 2) m[val1]++;
        s.erase(x);
      } else {
        int ctr = 0;
        auto it = s.lower_bound(x);
        long long val1 = 0;
        if (it != s.begin()) {
          it--;
          long long val = x - (*it);
          val1 += val;
          ctr++;
          m[val]++;
        }
        auto it1 = s.upper_bound(x);
        if (it1 != s.end()) {
          long long val = (*it1) - x;
          val1 += val;
          ctr++;
          m[val]++;
        }
        if (ctr == 2) m[val1]--;
        if (m[val1] == 0) m.erase(val1);
        s.insert(x);
      }
      auto it = m.end();
      if (it == m.begin())
        cout << "0\n";
      else {
        auto it1 = s.begin();
        auto it2 = s.end();
        it2--;
        long long ans = (*it2) - (*it1);
        it--;
        ans -= it->first;
        cout << ans << "\n";
      }
    }
  }
  return 0;
}
