#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    long long n,x,k,br=0;
    cin>>n>>x;
    long long a[n];
    for (long long i=0;i<n;i++)
    {
        cin>>a[i];
    }
    for (long long i=0;i<n;i++)
    {
        if (x<a[i])
        {
            br=br+abs(a[i]-x);
            x=a[i];
        }
        else
        {
            br=br+abs(x-a[i]);
            x=a[i];
        }
    }
    cout<<br;
    return 0;
}