import java.util.Arrays;
import java.util.Scanner;

/**
 *
 * @author Ivan
 */
public class Upoznavanje {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n,x,i;
        int[] a;
        n = input.nextInt();
        a = new int[n];
        x = input.nextInt();
        int sum = 0;
        for(i=0;i<n;i++){
            a[i] = input.nextInt();
        }
        Arrays.sort(a);
        for(i=0;i<n;i++){
            if(a[i]>=x){
                sum = sum + (a[i]-x);
            }
            else if(a[i]<=x){
                sum = sum + (x - a[i]);
            }
            x=a[i];
        }
        
        System.out.println(sum);
        
    }
    
}