#include <iostream>
#include <cmath>
using namespace std;

int main(int argc, const char * argv[]) {
    long long unsigned int x,n,i,sum;
    cin>>n>>x;
    long long unsigned int a[n];
    for (i = 0; i<n; i++)
    {
        cin>>a[i];
        
    }
    
    sum = abs(int(a[0]-x));
    
    
    for (i = 0 ; i < n-1 ; i ++)
        {
            
            sum = sum + abs(int(a[i+1]-a[i]));
        }
    
    cout<<sum;
    
    
    return 0;
    
}