// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



template <class T> bool minimize(T &x, const T &y) {

    if (x > y) x = y; else return false; return true;

}



typedef long long ll;



const int N = 2e5 + 10;



int n, m, A, B;

int a[N];

ll s[N], bit1[N], bit2[N], f[N];



void upbit1(int x, ll para) {

    for (; x <= n; x += x & -x)

        minimize(bit1[x], para);

}



ll getbit1(int x) {

    ll ret = (ll)(1e16);

    for (; x; x -= x & -x)

        minimize(ret, bit1[x]);

    return ret;

}



void upbit2(int x, ll para) {

    for (; x; x -= x & -x)

        minimize(bit2[x], para);

}



ll getbit2(int x) {

    ll ret = (ll)(1e16);

    for (; x <= n; x += x & -x)

        minimize(ret, bit2[x]);

    return ret;

}



int main() {

    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> n >> m >> A >> B;

    for (int i = 1; i <= m; i++)

        cin >> a[i];

    /// init

    for (int i = 2; i <= m; i++) {

        s[i] = s[i - 1] + (ll)(abs(a[i] - a[i - 1]));

        /// A B

        f[i] = 1ll * abs(B - a[i]) + 1ll * abs(A - a[1]) + s[i - 1];

        /// B A

        f[i] = min(f[i], 1ll * abs(A - a[i]) + 1ll * abs(B - a[1]) + s[i - 1]);

    }

    memset(bit1, 60, sizeof(bit1));

    memset(bit2, 60, sizeof(bit2));

    /// dp

    for (int i = 2; i <= m; i++) {

        /// ai >= aj

        minimize(f[i], getbit1(a[i]) + (ll)(a[i]) + s[i - 1]);

        /// ai < aj

        minimize(f[i], getbit2(a[i] + 1) - (ll)(a[i]) + s[i - 1]);

        /// update

        upbit1(a[i - 1], f[i] - s[i] - (ll)(a[i - 1]));

        upbit2(a[i - 1], f[i] - s[i] + (ll)(a[i - 1]));

    }

    ll res = min(abs(a[1] - A), abs(a[1] - B)) + s[m];

    for (int i = 2; i <= m; i++)

        minimize(res, f[i] + s[m] - s[i]);

    cout << res;

}


// Faster C++ solution for the same problem (measured speedup: 4.136719088953913x):
#include<bits/stdc++.h>

using namespace std;

#define y1 A2Dalek

#define y0 Cyberman

#define yn RoseTyler

#define j1 JackHarkness

#define fs first

#define sd second

const int N=2e5;

const long long oo=1e16+5;

int du[]={-1,0,0,1};

int dv[]={0,-1,1,0};

const long long mod=1e9+7;

typedef pair<int,int> ii;

typedef pair<int,ii> iii;

long long sqr(long long x) {return x*x;}

int getbit(int state, int i) {return ((state>>i)&1);}



int n,nq,A,B,q[N+5];

long long res=oo;

struct IT

{

    long long f[4*N+5];

    long long lz[4*N+5];

    long long a[N+5];

    void build(int id, int l, int r)

    {

        if (l>r) return;

        if (l==r) {f[id]=a[l]; return;}

        int mid=(l+r)/2;

        build(id*2,l,mid); build(id*2+1,mid+1,r);

        f[id]=min(f[id*2],f[id*2+1]);

    }

    void down(int id)

    {

        long long val=lz[id]; lz[id]=0;

        f[id*2]+=val; f[id*2+1]+=val;

        lz[id*2]+=val; lz[id*2+1]+=val;

    }

    void update(int id, int l, int r, int u, long long val)

    {

        if (l>u || r<u || l>r) return;

        if (l==r)

        {

            f[id]=min(f[id],val);

            return;

        }

        int mid=(l+r)/2;

        down(id);

        update(id*2,l,mid,u,val); update(id*2+1,mid+1,r,u,val);

        f[id]=min(f[id*2],f[id*2+1]);

    }

    long long get(int id, int l, int r, int u, int v)

    {

        if (l>r || l>v || r<u) return oo;

        if (u<=l && r<=v) return f[id];

        int mid=(l+r)/2;

        down(id);

        return min(get(id*2,l,mid,u,v),get(id*2+1,mid+1,r,u,v));

    }

} tru,cong;

int main()

{

	//freopen("Many Moves.inp","r",stdin);

	//freopen("Many Moves.out","w",stdout);

	ios_base::sync_with_stdio(false);

    cin>>n>>nq;

    cin>>A>>B;

    for (int i=1;i<=n;i++)

    {

        tru.a[i]=abs(B-i)-i;

        cong.a[i]=abs(B-i)+i;

    }

    tru.build(1,1,n); cong.build(1,1,n);

    q[0]=A;

    for (int i=1;i<=nq;i++)

    {

        cin>>q[i];

        long long val=abs(q[i]-q[i-1]);

        long long now=min(tru.get(1,1,n,1,q[i])+q[i], cong.get(1,1,n,q[i],n)-q[i]);

        tru.f[1]+=val; cong.f[1]+=val;

        tru.lz[1]+=val; cong.lz[1]+=val;

        tru.update(1,1,n,q[i-1],now-q[i-1]);

        cong.update(1,1,n,q[i-1],now+q[i-1]);

    }

    for (int i=1;i<=n;i++)

    {

        res=min(res,tru.get(1,1,n,i,i)+i);

    }

    cout<<res;

	return 0;

}