This is an easier version of the next problem. In this version, $q = 0$.

A sequence of integers is called nice if its elements are arranged in blocks like in $[3, 3, 3, 4, 1, 1]$. Formally, if two elements are equal, everything in between must also be equal.

Let's define difficulty of a sequence as a minimum possible number of elements to change to get a nice sequence. However, if you change at least one element of value $x$ to value $y$, you must also change all other elements of value $x$ into $y$ as well. For example, for $[3, 3, 1, 3, 2, 1, 2]$ it isn't allowed to change first $1$ to $3$ and second $1$ to $2$. You need to leave $1$'s untouched or change them to the same value.

You are given a sequence of integers $a_1, a_2, \ldots, a_n$ and $q$ updates.

Each update is of form "$i$ $x$" — change $a_i$ to $x$. Updates are not independent (the change stays for the future).

Print the difficulty of the initial sequence and of the sequence after every update.


-----Input-----

The first line contains integers $n$ and $q$ ($1 \le n \le 200\,000$, $q = 0$), the length of the sequence and the number of the updates.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 200\,000$), the initial sequence.

Each of the following $q$ lines contains integers $i_t$ and $x_t$ ($1 \le i_t \le n$, $1 \le x_t \le 200\,000$), the position and the new value for this position.


-----Output-----

Print $q+1$ integers, the answer for the initial sequence and the answer after every update.


-----Examples-----
Input
5 0
3 7 3 7 3

Output
2

Input
10 0
1 2 1 2 3 1 1 1 50 1

Output
4

Input
6 0
6 6 3 3 4 4

Output
0

Input
7 0
3 3 1 3 2 1 2

Output
4

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '#!usr/bin/env python3\nfrom collections import defaultdict,deque\nfrom heapq import heappush, heappop\nimport sys\nimport math\nimport bisect\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\ndef S():\n    res = list(sys.stdin.readline())\n    if res[-1] == "\\n":\n        return res[:-1]\n    return res\ndef IR(n):\n    return [I() for i in range(n)]\ndef LIR(n):\n    return [LI() for i in range(n)]\ndef SR(n):\n    return [S() for i in range(n)]\ndef LSR(n):\n    return [LS() for i in range(n)]\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\n#A\ndef A():\n    n = I()\n    a = LI()\n    a.sort()\n    f = [1]*n\n    p = 0\n    ans = 0\n    while p < n:\n        while p < n and not f[p]:\n            p += 1\n        if p == n:\n            break\n        ans += 1\n        for i in range(n):\n            if a[i]%a[p] == 0:\n                f[i] = 0\n    print(ans)\n    return\n\n#B\ndef B():\n    n = I()\n    s = list(map(int, input()))\n    g = LIR(n)\n    ans = sum(s)\n    for t in range(30000):\n        for i in range(n):\n            ai,bi = g[i]\n            if t < bi:\n                continue\n            if (t-bi)%ai == 0:\n                s[i] ^= 1\n        su = sum(s)\n        if ans < su:\n            ans = su\n    print(ans)\n    return\n\n#C\ndef C():\n    t = I()\n    for _ in range(t):\n        n = I()\n        s = list(map(int, input()))\n        mi = [s[-1]]\n        for i in range(n-1)[::-1]:\n            mi.append(min(mi[-1],s[i]))\n        mi = mi[::-1]\n        ans = [None]*n\n        for i in range(n):\n            if mi[i] == s[i]:\n                ans[i] = 1\n            else:\n                ans[i] = 2\n        q = [s[i] for i in range(n) if ans[i] > 1]\n        p = [q[i] for i in range(len(q))]\n        p.sort()\n        if p == q:\n            for i in ans:\n                print(i,end = "")\n            print()\n        else:\n            print("-")\n    return\n\n#D\ndef D():\n    def root(x):\n        if x == par[x]:\n            return x\n        par[x] = root(par[x])\n        return par[x]\n\n    def unite(x,y):\n        x = root(x)\n        y = root(y)\n        if rank[x] < rank[y]:\n            par[x] = y\n        else:\n            par[y] = x\n            if rank[x] == rank[y]:\n                rank[x] += 1\n\n    n,k = LI()\n    par = [i for i in range(n)]\n    rank = [0]*n\n    for i in range(k):\n        x,y = LI()\n        x -= 1\n        y -= 1\n        if root(x) != root(y):\n            unite(x,y)\n    size = [0]*n\n    for i in range(n):\n        size[root(i)] += 1\n    ans = 0\n    for i in size:\n        if i > 0:\n            ans += i-1\n    print(k-ans)\n    return\n\n#E\ndef E():\n    t = I()\n    for _ in range(t):\n        n,m = LI()\n        s = LIR(n)\n        s = [[s[i][j] for i in range(n)] for j in range(m)]\n        if n <= m:\n            ma = [max(s[i]) for i in range(m)]\n            ma.sort(reverse = True)\n            print(sum(ma[:n]))\n        else:\n            ans = 0\n            k = [[]]\n            for _ in range(m):\n                k_ = []\n                for i in range(n):\n                    k_ += [x+[i] for x in k]\n                k = [x for x in k_]\n            for l in k:\n                s_ = [[s[i][(j+l[i])%n] for j in range(n)] for i in range(m)]\n                print(l)\n                p = sum([max([s_[i][j] for i in range(m)]) for j in range(n)])\n                print(s_,p)\n                if ans < p:\n                    ans = p\n            print(ans)\n    return\n\n#F\ndef F():\n\n    return\n\n#G\ndef G():\n    def root(x):\n        if x == par[x]:\n            return x\n        par[x] = root(par[x])\n        return par[x]\n\n    def unite(x,y):\n        x = root(x)\n        y = root(y)\n        if rank[x] < rank[y]:\n            par[x] = y\n        else:\n            par[y] = x\n            if rank[x] == rank[y]:\n                rank[x] += 1\n\n    m = 200000\n    par = [i for i in range(m)]\n    rank = [0]*m\n    n,q = LI()\n    a = LI()\n    for i in range(n):\n        a[i] -= 1\n    count = defaultdict(lambda : 0)\n    l = defaultdict(lambda : 0)\n    lis = []\n    for i in range(n):\n        ai = a[i]\n        if count[ai] == 0:\n            l[ai] = i\n            lis.append(ai)\n        count[ai] += 1\n    f = defaultdict(lambda : 0)\n    r = defaultdict(lambda : 0)\n    for i in range(n)[::-1]:\n        ai = a[i]\n        if not f[ai]:\n            r[ai] = i\n            f[ai] = 1\n    f = [0]*n\n    for i in lis:\n        li,ri = l[i],r[i]\n        f[li] += 1\n        f[ri] -= 1\n    for i in range(n-1):\n        if f[i] > 0:\n            x,y = a[i], a[i+1]\n            if root(x) != root(y):\n                unite(x,y)\n        f[i+1] += f[i]\n    size = defaultdict(lambda : [])\n    for i in l:\n        size[root(i)].append(count[i])\n    ans = 0\n    for i in size.values():\n        ans += sum(i)-max(i)\n    print(ans)\n    return\n\n#H\ndef H():\n\n    return\n\n#Solve\ndef __starting_point():\n    G()\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 9634803