using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var ulaz = Console.ReadLine().Split();
            int n = int.Parse(ulaz[0]);
            int x = int.Parse(ulaz[1]);                     
            int i = 0;          
            int[] a = new int[n];
            for (i = 0; i < n; i++)
            {
                var ulaz2 = Console.ReadLine().Split();
                a[i] = int.Parse(ulaz2[i]);
            }
            int s = 0;
            for(i = 0; i < n; i++)
            {
                if(a[i] < x)
                {
                    s = x - a[i];
                }
                else if(a[x] > x)
                {
                    s = a[i] - x;
                }
            }
            Console.WriteLine(s);
        }
    }
}