#include <iostream>

using namespace std;

int main()
{
    int n,k,a[10000],s1,s2,t,res = 0;
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        cin >> a[i];
    }
    if (k == n) cout << 0;
    else if (k == n - 1) cout << 1;
    else {
        cout << 3 * (n - k - 1);
    }
    return 0;
}
