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')


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)


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


def mpint():
    return map(int, sys.stdin.readline().split(' '))


def itg():
    return int(sys.stdin.readline())


# ############################## import
from heapq import *


class Fenwick:
    """ Simpler FenwickTree """

    def __init__(self, x):
        self.bit = [0] * x

    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(bit[:idx]) < k
        (!) different from pyrival (just removed the '=')
        """
        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


class Cset:
    def __init__(self, discrete_data):
        discrete_data = set(discrete_data)
        self.restore = tuple(sorted(discrete_data))
        self.max_size = len(self.restore)
        self.size = 0
        self.discrete_dict = dict(zip(self.restore, range(self.max_size)))
        self.bit = Fenwick(self.max_size + 1)
        self.nums = [False] * (self.max_size + 1)

    def __getitem__(self, index):
        return self.restore[self.bit.findkth(index % self.size + 1)]

    def add(self, val):
        if val not in self.discrete_dict:
            return
        val = self.discrete_dict[val]
        if val < 0 or val > self.max_size or self.nums[val]:
            return
        self.size += 1
        self.bit.update(val, 1)
        self.nums[val] = True

    def discard(self, val):
        if val not in self.discrete_dict:
            return
        val = self.discrete_dict[val]
        if val < 0 or val > self.max_size or not self.nums[val]:
            return
        self.size -= 1
        self.bit.update(val, -1)
        self.nums[val] = False

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

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

    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.size:
            return None
        return self[index]

    def __delitem__(self, index):
        val = self.bit.findkth(index % self.size + 1)
        self.size -= 1
        self.bit.update(val, -1)
        self.nums[val] = False

    def pop(self, index):
        val = self[index]
        del self[index]
        return val

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

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

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

    def __len__(self):
        return self.size

    def __bool__(self):
        return self.size > 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 __getitem__(self, index):
        self.__trim()
        return self.heap[index]

    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)
    discrete_data = set(discrete_data)
    indices = Cset(discrete_data)
    intervals = RemovableHeap(int)
    for a in arr:
        indices.add(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[0]

    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.discard(x)
        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.add(x)
        print(query())


if __name__ == '__main__':
    solve()
    # for _ in range(itg()):
    #     print(solve())
# Please check!