#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char ch;
  while (!isdigit(ch = getchar()))
    ;
  x = ch - 48;
  while (isdigit(ch = getchar())) x = x * 10 + ch - 48;
  return x;
}
int n, k, ans;
vector<int> a[(int)1e5 + 5];
inline bool check(int x, int y) {
  if (!a[x].size() || !a[y].size()) return 1;
  if (a[x][a[x].size() - 1] < a[y][0]) return 1;
  return 0;
}
int main() {
  n = read(), k = read();
  for (int i = 1; i <= k; i++) a[read()].push_back(i);
  for (int i = 1; i <= n; i++)
    if (a[i].size()) sort(a[i].begin(), a[i].end());
  for (int i = 1; i <= n; i++)
    if (!a[i].size()) ans++;
  for (int i = 1; i < n; i++) ans += check(i, i + 1), ans += check(i + 1, i);
  printf("%d\n", ans);
  return 0;
}
