#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int n,x,br=0,a,br1=0;
    vector <int> v1;
    cin >> n >> x;
    for (int i=0; i<n; i++)
    {
        cin >> a;
        v1.push_back(a);
        if (a<0)
            br1++;
    }
    if (br1<2)
    {
        sort(v1.begin(),v1.end());
    }
    else
        sort(v1.begin(),v1.end(),greater<int>());
    for (unsigned j=0; j<v1.size(); j++)
    {
        br=br+abs(x-v1[j]);
        x=v1[j];
    }
    cout << br <<endl;
    return 0;
}