#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, q, i, j, k, x, t, ans, mid, minn, maxx;
  cin >> n >> q;
  vector<int> a(n);
  set<int> s;
  set<int>::iterator it, it2;
  for (i = 0; i < n; i++) {
    cin >> x;
    a[i] = x;
    s.insert(x);
  }
  sort(a.begin(), a.end());
  set<pair<int, int>> ss;
  for (i = 0; i < n - 1; i++) {
    ss.insert({a[i + 1] - a[i], a[i]});
  }
  if (s.size() <= 2)
    ans = 0;
  else
    ans = (*s.rbegin() - *s.begin()) - ss.rbegin()->first;
  cout << ans << "\n";
  while (q--) {
    cin >> t >> x;
    if (t == 0) {
      if (s.size() > 1) {
        if (x == *s.begin()) {
          it = s.begin();
          it++;
          ss.erase({*it - x, x});
        } else if (x == *s.rbegin()) {
          it = s.end();
          it--;
          it--;
          ss.erase({x - *it, *it});
        } else {
          it = s.upper_bound(x);
          it2 = it;
          it2--;
          it2--;
          ss.insert({*it - *it2, *it2});
          ss.erase({x - *it2, *it2});
          ss.erase({*it - x, x});
        }
      } else {
        ss.clear();
      }
      s.erase(x);
    } else {
      if (!s.empty()) {
        if (x < *s.begin()) {
          ss.insert({*s.begin() - x, x});
        } else if (x > *s.rbegin()) {
          ss.insert({x - *s.rbegin(), *s.rbegin()});
        } else {
          it = s.lower_bound(x);
          it2 = it;
          it2--;
          ss.erase({*it - *it2, *it2});
          ss.insert({x - *it2, *it2});
          ss.insert({*it - x, x});
        }
      }
      s.insert(x);
    }
    if (s.size() <= 2)
      ans = 0;
    else
      ans = (*s.rbegin() - *s.begin()) - ss.rbegin()->first;
    cout << ans << "\n";
  }
  return 0;
}
