using System;
class Program {
    static void Main() {
        string s = Console.ReadLine();
        string[] o = s.Split(null);
        int n = int.Parse(o[0]);
        int x = int.Parse(o[1]);
        s = Console.ReadLine();
        o = s.Split(null);
        int[] k = new int[n];
        for(int i = 0; i < n; i++) { k[i] = int.Parse(o[i]); }
        int sum = 0;
        for(int i = 0; i < n; i++) {
            if(i == 0) { sum += Math.Abs(x - k[0]); }
            else { sum += Math.Abs(k[i] - k[i - 1]); }
        }
        Console.WriteLine(sum);
    }
}