Problem: Vova decided to clean his room. The room can be represented as the coordinate axis OX. There are n piles of trash in the room, coordinate of the i-th pile is the integer p_i. All piles have different coordinates.

Let's define a total cleanup as the following process. The goal of this process is to collect all the piles in no more than two different x coordinates. To achieve this goal, Vova can do several (possibly, zero) moves. During one move, he can choose some x and move all piles from x to x+1 or x-1 using his broom. Note that he can't choose how many piles he will move.

Also, there are two types of queries:

  * 0 x — remove a pile of trash from the coordinate x. It is guaranteed that there is a pile in the coordinate x at this moment. 
  * 1 x — add a pile of trash to the coordinate x. It is guaranteed that there is no pile in the coordinate x at this moment. 



Note that it is possible that there are zero piles of trash in the room at some moment.

Vova wants to know the minimum number of moves he can spend if he wants to do a total cleanup before any queries. He also wants to know this number of moves after applying each query. Queries are applied in the given order. Note that the total cleanup doesn't actually happen and doesn't change the state of piles. It is only used to calculate the number of moves.

For better understanding, please read the Notes section below to see an explanation for the first example.

Input

The first line of the input contains two integers n and q (1 ≤ n, q ≤ 10^5) — the number of piles in the room before all queries and the number of queries, respectively.

The second line of the input contains n distinct integers p_1, p_2, ..., p_n (1 ≤ p_i ≤ 10^9), where p_i is the coordinate of the i-th pile.

The next q lines describe queries. The i-th query is described with two integers t_i and x_i (0 ≤ t_i ≤ 1; 1 ≤ x_i ≤ 10^9), where t_i is 0 if you need to remove a pile from the coordinate x_i and is 1 if you need to add a pile to the coordinate x_i. It is guaranteed that for t_i = 0 there is such pile in the current set of piles and for t_i = 1 there is no such pile in the current set of piles.

Output

Print q+1 integers: the minimum number of moves Vova needs to do a total cleanup before the first query and after each of q queries.

Examples

Input


5 6
1 2 6 8 10
1 4
1 9
0 6
0 10
1 100
1 50


Output


5
7
7
5
4
8
49


Input


5 8
5 1 2 4 3
0 1
0 2
0 3
0 4
0 5
1 1000000000
1 1
1 500000000


Output


3
2
1
0
0
0
0
0
499999999

Note

Consider the first example.

Initially, the set of piles is [1, 2, 6, 8, 10]. The answer before the first query is 5 because you can move all piles from 1 to 2 with one move, all piles from 10 to 8 with 2 moves and all piles from 6 to 8 with 2 moves.

After the first query, the set becomes [1, 2, 4, 6, 8, 10]. Then the answer is 7 because you can move all piles from 6 to 4 with 2 moves, all piles from 4 to 2 with 2 moves, all piles from 2 to 1 with 1 move and all piles from 10 to 8 with 2 moves.

After the second query, the set of piles becomes [1, 2, 4, 6, 8, 9, 10] and the answer is the same (and the previous sequence of moves can be applied to the current set of piles).

After the third query, the set of piles becomes [1, 2, 4, 8, 9, 10] and the answer is 5 because you can move all piles from 1 to 2 with 1 move, all piles from 2 to 4 with 2 moves, all piles from 10 to 9 with 1 move and all piles from 9 to 8 with 1 move.

After the fourth query, the set becomes [1, 2, 4, 8, 9] and the answer is almost the same (the previous sequence of moves can be applied without moving piles from 10).

After the fifth query, the set becomes [1, 2, 4, 8, 9, 100]. You can move all piles from 1 and further to 9 and keep 100 at its place. So the answer is 8.

After the sixth query, the set becomes [1, 2, 4, 8, 9, 50, 100]. The answer is 49 and can be obtained with almost the same sequence of moves as after the previous query. The only difference is that you need to move all piles from 50 to 9 too.

Solution (in PYTHON3):

Solution:
import os
import sys
from io import BytesIO, IOBase

_str = str
BUFSIZE = 8192


def str(x=b''):
    return x if type(x) is bytes else _str(x).encode()


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = 'x' in file.mode or 'r' not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b'\n') + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode('ascii'))
        self.read = lambda: self.buffer.read().decode('ascii')
        self.readline = lambda: self.buffer.readline().decode('ascii')


def inp():
    return sys.stdin.readline().rstrip()


def mpint():
    return map(int, inp().split(' '))


def itg():
    return int(inp())


# ############################## import
# from ACgenerator.Y_Testing import get_code
class FenwickTree:  # pyrival
    def __init__(self, x=[]):
        """ transform list into BIT """
        self.bit = x
        for i in range(len(x)):
            j = i | (i + 1)
            if j < len(x):
                x[j] += x[i]

    def update(self, idx, x):
        """ updates bit[idx] += x """
        while idx < len(self.bit):
            self.bit[idx] += x
            idx |= idx + 1

    def query(self, end):
        """ calc sum(bit[:end]) """
        x = 0
        while end:
            x += self.bit[end - 1]
            end &= end - 1
        return x

    def findkth(self, k):
        """
        Find largest idx such that sum(x[:idx]) <= k
        all of the element in x have to be non-negative
        """
        idx = -1
        for d in reversed(range(len(self.bit).bit_length())):
            right_idx = idx + (1 << d)
            if right_idx < len(self.bit) and k >= self.bit[right_idx]:
                idx = right_idx
                k -= self.bit[idx]
        return idx + 1


from heapq import heappop, heappush


class Transform(int):
    def __lt__(self, other):
        return self >= other


class DiscreteSortedList:
    def __init__(self, discrete_data):
        """:param discrete_data: sorted(set(ALL_INPUT_DATA)) """
        self.restore = discrete_data
        self.DISCRETE_SIZE = len(self.restore)
        self._len = 0
        self.discrete_dict = dict(zip(self.restore, range(self.DISCRETE_SIZE)))
        self._fen = FenwickTree([0] * (self.DISCRETE_SIZE + 1))
        self.nums = [0] * (self.DISCRETE_SIZE + 1)

    def update(self, val, num=1):
        val = self.discrete_dict[val]
        if num < -self.nums[val]:
            num = -self.nums[val]
        self.nums[val] += num
        self._len += num
        self._fen.update(val, num)

    def clear(self):
        self.nums = [0] * (self.DISCRETE_SIZE + 1)
        self._fen.bit = [0] * (self.DISCRETE_SIZE + 1)
        self._len = 0

    def count(self, val):
        return self.nums[self.discrete_dict[val]]

    def bisect_left(self, val):
        """ index of val """
        return self._fen.query(self.discrete_dict[val])

    def bisect_right(self, val):
        return self._fen.query(self.discrete_dict[val] + 1)

    def __getitem__(self, index):
        if self._len == 0:
            return None
        return self.restore[self._fen.findkth(index % self._len)]

    def lower(self, val):
        index = self.bisect_left(val)
        if index == 0:
            return None
        return self[index - 1]

    def higher(self, val):
        index = self.bisect_right(val)
        if index == self._len:
            return None
        return self[index]

    def to_dict(self):
        result = {}
        val = self[0]
        while val:
            result[val] = self.count(val)
            val = self.higher(val)
        return result

    def __contains__(self, item):
        return self.nums[self.discrete_dict[item]] > 0

    def ceiling(self, val):
        return val if val in self else self.higher(val)

    def floor(self, val):
        return val if val in self else self.lower(val)

    def __iter__(self):
        return (self.__getitem__(index) for index in range(self._len))

    def __repr__(self):
        return 'DiscreteSortedList({})'.format(list(self))

    def __len__(self):
        return self._len

    def __bool__(self):
        return self._len > 0


class RemovableHeap:
    def __init__(self, max_heap_type=None):
        if max_heap_type:  # element's class
            class Transform(max_heap_type):
                def __lt__(self, other):
                    return self >= other

            self._T = Transform
        else:
            self._T = lambda x: x
        self.heap = []
        self.rem = []
        self.dict = {}
        self.size = 0

    def __len__(self):
        return self.size

    def peek(self):
        self.__trim()
        return self.heap[0]

    def push(self, val):
        val = self._T(val)
        heappush(self.heap, val)
        if val in self.dict:
            self.dict[val] += 1
        else:
            self.dict[val] = 1
        self.size += 1

    def pop(self):
        self.__trim()
        if not self.heap:
            return None
        self.size -= 1
        val = heappop(self.heap)
        if self.dict[val] == 1:
            del self.dict[val]
        else:
            self.dict[val] -= 1
        return val

    def remove(self, val):
        val = self._T(val)
        if val not in self.dict:
            return
        self.size -= 1
        if self.dict[val] == 1:
            del self.dict[val]
        else:
            self.dict[val] -= 1
        heappush(self.rem, val)

    def __trim(self):
        while self.rem and self.rem[0] == self.heap[0]:
            heappop(self.heap)
            heappop(self.rem)


# ############################## main
def solve():
    n, q = mpint()
    arr = sorted(mpint())
    discrete_data = arr.copy()
    input_data = [tuple(mpint()) for _ in range(q)]
    for t, x in input_data:
        if t == 1:
            discrete_data.append(x)
    indices = DiscreteSortedList(sorted(set(discrete_data)))
    intervals = RemovableHeap(int)
    for a in arr:
        indices.update(a)

    for i in range(1, n):
        intervals.push(arr[i] - arr[i - 1])

    def query():
        if not intervals:
            return 0
        return indices[-1] - indices[0] - intervals.peek()

    print(query())

    for t, x in input_data:
        if t == 0:  # discard
            lower = indices.lower(x)
            higher = indices.higher(x)
            if lower:
                intervals.remove(x - lower)
            if higher:
                intervals.remove(higher - x)
            if lower and higher:
                intervals.push(higher - lower)
            indices.update(x, -1)
        else:  # add
            lower = indices.lower(x)
            higher = indices.higher(x)
            if higher and lower:
                intervals.remove(higher - lower)
            if lower:
                intervals.push(x - lower)
            if higher:
                intervals.push(higher - x)
            indices.update(x)
        print(query())


def main():
    # print("YES" if solve() else "NO")
    # print("yes" if solve() else "no")
    solve()
    # print(solve())
    # for _ in range(itg()):
    #     print(solve())


DEBUG = 0
URL = 'https://codeforces.com/contest/1418/problem/D'

if __name__ == '__main__':
    if DEBUG == 1:
        import requests  # ImportError: cannot import name 'md5' from 'sys' (unknown location)
        from ACgenerator.Y_Test_Case_Runner import TestCaseRunner

        runner = TestCaseRunner(main, URL)
        inp = runner.input_stream
        print = runner.output_stream
        runner.checking()
    elif DEBUG == 2:
        main()
    else:
        sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
        main()
# Please check!