Alice and Bob are playing a game on a line with $n$ cells. There are $n$ cells labeled from $1$ through $n$. For each $i$ from $1$ to $n-1$, cells $i$ and $i+1$ are adjacent.

Alice initially has a token on some cell on the line, and Bob tries to guess where it is. 

Bob guesses a sequence of line cell numbers $x_1, x_2, \ldots, x_k$ in order. In the $i$-th question, Bob asks Alice if her token is currently on cell $x_i$. That is, Alice can answer either "YES" or "NO" to each Bob's question.

At most one time in this process, before or after answering a question, Alice is allowed to move her token from her current cell to some adjacent cell. Alice acted in such a way that she was able to answer "NO" to all of Bob's questions.

Note that Alice can even move her token before answering the first question or after answering the last question. Alice can also choose to not move at all.

You are given $n$ and Bob's questions $x_1, \ldots, x_k$. You would like to count the number of scenarios that let Alice answer "NO" to all of Bob's questions. 

Let $(a,b)$ denote a scenario where Alice starts at cell $a$ and ends at cell $b$. Two scenarios $(a_i, b_i)$ and $(a_j, b_j)$ are different if $a_i \neq a_j$ or $b_i \neq b_j$.


-----Input-----

The first line contains two integers $n$ and $k$ ($1 \leq n,k \leq 10^5$) — the number of cells and the number of questions Bob asked.

The second line contains $k$ integers $x_1, x_2, \ldots, x_k$ ($1 \leq x_i \leq n$) — Bob's questions.


-----Output-----

Print a single integer, the number of scenarios that let Alice answer "NO" to all of Bob's questions.


-----Examples-----
Input
5 3
5 1 4

Output
9

Input
4 8
1 2 3 4 4 3 2 1

Output
0

Input
100000 1
42

Output
299997



-----Note-----

The notation $(i,j)$ denotes a scenario where Alice starts at cell $i$ and ends at cell $j$.

In the first example, the valid scenarios are $(1, 2), (2, 1), (2, 2), (2, 3), (3, 2), (3, 3), (3, 4), (4, 3), (4, 5)$. For example, $(3,4)$ is valid since Alice can start at cell $3$, stay there for the first three questions, then move to cell $4$ after the last question. 

$(4,5)$ is valid since Alice can start at cell $4$, stay there for the first question, the move to cell $5$ for the next two questions. Note that $(4,5)$ is only counted once, even though there are different questions that Alice can choose to do the move, but remember, we only count each pair of starting and ending positions once.

In the second example, Alice has no valid scenarios.

In the last example, all $(i,j)$ where $|i-j| \leq 1$ except for $(42, 42)$ are valid scenarios.

Difficulty: interview

Starter code:

Solutions:
nCells, nQueries = list(map(int, input().split()))
queries = list(map(int, input().split()))
seen = [False] * 100002
bad = set()
for q in queries:
    if not seen[q]:
        seen[q] = True
        bad.add((q, q))
    if seen[q - 1]:
        bad.add((q - 1, q))
    if seen[q + 1]:
        bad.add((q + 1, q))
print((nCells - 1) * 2 + nCells - len(bad))


n , k = list(map(int , input().split()))
ques = []
last = [-1]*(n+2)
last[0] = 10000000
last[n+1] = 10000000
frst = [-1]*(n+2)
#print(frst)

ques = input().split()
for i in range(len(ques)):
    ques[i] = int(ques[i])
#print(type(ques[i]))
    
ans = n * 3

for i in range(k):
    
    if frst[ques[i]] == -1 :
            frst[ques[i]] = i    
    #if last[ques[i]] < i :
    last[ques[i]] = i    

    '''try:
        if frst[ques[k]] > k :
            frst[ques[k]] = k    
        if last[ques[k]] < k :
            last[ques[k]] = k    
    except :
        print(("k : {}".format(k)))'''
    '''for x in range(1 , n+1) :
        if last[x] == int(-1) :
            print(x)
            frst[x] = -1
            last[x] = 10000000'''
#print(frst)
#print(last)
cnt = 0
for i in range(1 , n+1):
    if frst[i] != -1 :
        if frst[i] < last[i-1]:
            cnt += 1
        if frst[i] < last[i+1] :
            cnt += 1
            #print("fst : {} < lst : {}").format(frst[i] , last[i+1])
        if frst[i] != -1 :
            cnt += 1
if frst[1] == -1 : cnt+= 1
if frst[n] == -1 : cnt+= 1

ans = ans - cnt 
print(ans)


intin=lambda:list(map(int,input().split()))
Ain=lambda:list(map(int,input().split()))
mod=1000000007

n,k=intin()
a=Ain()
m=n+1

f=[-1]*m
l=[-1]*m

for i in range(k):
    x=a[i]
    if f[x]==-1: f[x]=i
    l[x]=i

ans=0
for i in range(1,m):
    if f[i]==-1:
        ans+=1
        if i>1: ans+=1
        if i<n: ans+=1
        continue
    if i<n and f[i]>l[i+1]: ans+=1
    if i>1 and f[i]>l[i-1]: ans+=1
print(ans)



    









n, m = map(int, input().split(' '))
s = list(map(int, input().split(' ')))

l = {i: m for i in range(n)}
r = {i: -1 for i in range(n)}

for i, a in enumerate(s):
    l[a - 1] = min(i, l[a - 1])
    r[a - 1] = max(i, r[a - 1])
    
count = 0
for i in range(n):
    for j in range(3):
        a = i
        b = i + j - 1
        if b < 0 or b == n:
            continue
        if l[a] > r[b]:
            count += 1
print(count)

def ck(p,q):
    return 1 if bpos[p]>fpos[q] else 0
n,k=map(int,input().split())
x=list(map(int,input().split()))
fpos=[-1 for i in range(100001)]
bpos=[k+5 for i in range(100001)]
for i in range(k):
    fpos[x[i]]=i
    bpos[x[k-1-i]]=k-1-i
ans=ck(n,n)
for i in range(1,n):
    ans+=ck(i,i)+ck(i,i+1)+ck(i+1,i)
print(ans)

import math
from decimal import Decimal
def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return n,b
 
 
def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return n,b,c
 
 
def dv():
	n, m = list(map(int, input().split()))
	return n,m
 
 
def dva():
	n, m = list(map(int, input().split()))
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return n,m,b
 
 
def eratosthenes(n): 
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))
 
 
 
def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return n,b,m,c
 
 
def dvs():
	n = int(input())
	m = int(input())
	return n, m
 
 
n, m = list(map(int, input().split()))
aa = [int(x) for x in input().split()]
l = {i: m for i in range(n)}
r = {i: -1 for i in range(n)}
for i, a in enumerate(aa):
	l[a - 1] = min(i, l[a - 1])
	r[a - 1] = max(i, r[a - 1])
ans = 0
for i in range(n):
	for j in range(3):
		a = i
		b = i + j - 1
		if b < 0 or b == n:
			continue
		if l[a] > r[b]:
			ans += 1
print(ans)


n, m = map(int, input().split(' '))
s = list(map(int, input().split(' ')))

l = {i: m for i in range(n)}
r = {i: -1 for i in range(n)}

for i, a in enumerate(s):
    l[a - 1] = min(i, l[a - 1])
    r[a - 1] = max(i, r[a - 1])
    
count = 0
for i in range(n):
    for j in range(3):
        a = i
        b = i + j - 1
        if b < 0 or b == n:
            continue
        if l[a] > r[b]:
            count += 1
print(count)

def solve():
	n,k = map(int,input().split())
	x = list(map(int,input().split()))
	fpos = [k for i in range(n+1)]
	lpos = [-1 for i in range(n+1)]
	for i in range(1,k+1):
		lpos[x[i-1]] = i
	for i in range(k,0,-1):
		fpos[x[i-1]] = i
	ans = 0
	for i in range(1,n+1):
		if lpos[i] == -1:
			ans+=1
	# print(ans)
	for i in range(1,n):
		if fpos[i] >= lpos[i+1]:
			ans += 1
		if fpos[i+1] >= lpos[i]:
			ans += 1

		# print(i,i+1,ans)
	print(ans)

def __starting_point():
	solve()
__starting_point()

N,cnt=[int(1e5+5000),int(0)]
class edg:
	pnt,nxt=[int(0),int(0)]
fir=[0]*N
ed=[edg()]
for i in range(1,N):
	ed.append(edg())
def link(u,v):
	nonlocal cnt
	cnt+=1
	ed[cnt].nxt=fir[u]
	fir[u]=cnt
	ed[cnt].pnt=v
#	print(ed[1].pnt,ed[2].pnt,ed[3].pnt)
#	print(cnt,ed[1].pnt,ed[1].nxt)
#	print(ed[2].pnt)
#print(ed[0].pnt)
n,k=list(map(int,input().split(" ")))
#print(n," ",k)
q=[0]+list(map(int,input().split(" ")))
#print(q[1])
#link(1,1)
#'''
for i in range(1,k+1):
#	u,v=[1,1]
	u,v=[q[i],i]
	link(u,v)
#	print(u,v)
#'''
#stay
'''
print(q)
u=5
e=fir[u]
print(ed[2].pnt)
'''
'''
print(ed[2].pnt,ed[3].pnt)
ed[2].pnt=1
print(ed[2].pnt,ed[3].pnt)
'''
ans=int(0)
for i in range(1,n+1):
	if(fir[i]==0):
		ans+=1
#left
for i in range(2,n+1):
	minx,maxx=[(1<<27),-(1<<27)]
	u=i
	e=fir[u]
	while(e!=0):
		minx=min(minx,ed[e].pnt)
		e=ed[e].nxt
	u=i-1
	e=fir[u]
	while(e!=0):
		maxx=max(maxx,ed[e].pnt)
		e=ed[e].nxt
	if(minx>maxx):
		ans+=1
#		print(i,i-1)
#right
for i in range(1,n):
	minx,maxx=[(1<<27),-(1<<27)]
	u=i
	e=fir[u]
	while(e!=0):
		minx=min(minx,ed[e].pnt)
		e=ed[e].nxt
	u=i+1
	e=fir[u]
	while(e!=0):
		maxx=max(maxx,ed[e].pnt)
		e=ed[e].nxt
	if(minx>maxx):
		ans+=1
#		print(i,i+1)
'''
	if(i==4):
#		print(minx,maxx)
		u=i+1
		e=fir[u]
		while(e!=0):
			print(ed[e].pnt)
			e=ed[e].nxt
'''
print(ans)



n, k = map(int, input().split())
x = [int(i) for i in input().split()]

first = [int(k + 1) for _ in range(n + 1)]
last = [int(-1) for _ in range(n + 1)]

for i in range(k):
    first[x[i]] = min(first[x[i]], i)
    last[x[i]] = max(last[x[i]], i)

cnt = 0
for i in range(1,n+1):
    if last[i] == -1:
        cnt += 1
    if i+1 <= n:
        if last[i] < first[i+1]:
            cnt += 1
        if last[i+1] < first[i]:
            cnt += 1

print(cnt)

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
fpos = [k for i in range(n + 1)]
lpos = [-1 for i in range(n + 1)]

for i in range(1, k + 1):
    lpos[x[i - 1]] = i
for i in range(k, 0, -1):
    fpos[x[i - 1]] = i

ans = 0
for i in range(1, n + 1):
    if lpos[i] == -1:
        ans += 1

for i in range(1, n):
    ans += (fpos[i] >= lpos[i + 1])
    ans += (fpos[i + 1] >= lpos[i])

print(ans)


n,k=map(int,input().split())
x=list(map(int,input().split()))
d={}
for i in range(k):
    d[x[i]]=i
ans=0
v=[0]*n
for i in range(k):
    if v[x[i]-1]==0:
        if x[i]!=1:
            if d.get(x[i]-1)==None or d.get(x[i]-1)<i:
                ans+=1
        if x[i]!=n:
            if d.get(x[i]+1)==None or d.get(x[i]+1)<i:
                ans+=1
        v[x[i]-1]=1
ans+=3*(n-len(d))
if d.get(1)==None:
    ans-=1
if d.get(n)==None:
    ans-=1
print(ans)

import sys
input = sys.stdin.readline
from collections import defaultdict

def lose(i, j):
    if i==j:
        return i in s
    else:
        return (i in s) and (j in s) and (first[i]<last[j])

n, k = map(int, input().split())
x = list(map(int, input().split()))
x = list(map(lambda x: x-1, x))
s = set(x)
first = defaultdict(int)
last = defaultdict(int)

for i in range(k):
    if x[i] not in first:
        first[x[i]] = i
    
for i in range(k-1, -1, -1):
    if x[i] not in last:
        last[x[i]] = i

ans = 3*n-2

for i in range(n):
    for j in range(max(i-1, 0), min(i+2, n)):
        if lose(i, j):
            ans -= 1

print(ans)

from collections import defaultdict
n,k=map(int,input().split())
lis=list(map(int,input().split()))
first={}
last=defaultdict(int)
length=len(lis)
for i in range(length):
    if lis[i] not in first:
        first[lis[i]]=i 
        
    last[lis[i]]=i 
count=0 

for i in range(1,n+1):
    if i not in first :
        if i==1 or i==n:
            count+=2
        else:
            
            count+=3 
        continue
        
    if i-1>0 and first[i] >= last[i-1]:
        count+=1 
    if i+1<=n and first[i] >= last[i+1]:
        count+=1 
print(count)

n,k = map(int,input().split())
a = list(map(int,input().split()))
p = [-1]*(n+1)
s = [-1]*(n+1)
for i in range(k):
	if p[a[i]]==-1:
		p[a[i]] = i
for i in range(k-1,-1,-1):
	if s[a[i]]==-1:
		s[a[i]] = i
count = 0
for i in range(1,n+1):
	if p[i]==-1:
		if i==1 or i==n:
			count+=2
			continue
		count += 3
	else:
		if i!=n and (s[i+1]==-1 or s[i+1]<p[i]):
			count += 1
		if i!=1 and (s[i-1]==-1 or s[i-1]<p[i]):
			count += 1
	# print (i,count)
print (count)

# from debug import debug
import sys

# t = int(input())
# for _ in range(t):
# n = inputt(input())
# s = input()
n, k = list(map(int, input().split()))
lis = list(map(int, input().split()))

v = [0]*(n+2)
p = [0]*(n+2)
c = [0]*n
# lis.reverse()
for i in lis:
	i-=1
	c[i] = 1
	if i+1<n and c[i+1] == 1:
		v[i+1] = 1
	if i-1>=0 and c[i-1] == 1:
		p[i-1] = 1

x = 0
for i in lis:
	i-=1
	if c[i]:
		x += c[i]+v[i]+p[i]
	else:
		if i+1<n:
			x+=c[i+1]
		if i-1>=0:
			x+=c[i-1]
# debug(v=v, p=p, c=c)
x = 0
for i in range(0, n):
	x += c[i]+v[i+1]+p[i-1]
# print(x)
print(3*n-2-x)




import sys

input = lambda: sys.stdin.readline().strip("\r\n")

n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
first = [k] * (n+1)
last = [-1] * (n+1)

for i in range(1, k+1):
    last[x[i-1]] = i
for i in range(k, 0, -1):
    first[x[i-1]] = i

ans = 0
# print(first)
# print(last)
for i in range(1, n+1):
    if last[i] == -1:
        ans += 1

for i in range(1, n):
    if first[i] >= last[i+1]:
        ans += 1
    if first[i+1] >= last[i]:
        ans += 1
print(ans)


n, k = map(int, input().split())
X = list(map(int, input().split()))

fallen = set()
pairs = set()

for x in X:
    if (x-1) in fallen:
        #pairs.add([x-1, x])
        pairs.add((x-1)*(n+1)+x)
    if (x+1) in fallen:
        #pairs.add([x+1, x])
        pairs.add((x+1)*(n+1)+x)
    fallen.add(x)

print( 2*(n-1)+n - len(pairs)-len(fallen) )

from collections import defaultdict
n,k=map(int,input().split())
ar=[int(x) for x in input().split()]
first=[10000000000]*(n+1)
last=[-1]*(n+1)

for i in range(k):
    first[ar[i]]=min(first[ar[i]],i)

for i in range(k-1,-1,-1):
    last[ar[i]]=max(last[ar[i]],i)

ans=0
for i in range(1,n+1):
    if(last[i]==-1):
        ans+=1
    if(i==n):
        continue
    if(last[i]<first[i+1]):
        ans+=1
    if(last[i+1]<first[i]):
        ans+=1
print(ans)