import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution{

    ///////////////////////////////////////////////////////////////////////////
    static class FastScanner{
        BufferedReader s;
        StringTokenizer st;

        public FastScanner(InputStream InputStream){
            st = new StringTokenizer("");
            s = new BufferedReader(new InputStreamReader(InputStream));
        }

        public FastScanner(File f) throws FileNotFoundException{
            st = new StringTokenizer("");
            s = new BufferedReader (new FileReader(f));
        }

        public int nextInt() throws IOException{
            if(st.hasMoreTokens())
                return Integer.parseInt(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextInt();
            }
        }

/*      public double nextDouble() throws IOException{
            if(st.hasMoreTokens())
                return Double.parseDouble(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextDouble();
            }
        }
*/
        public long nextLong() throws IOException{
            if(st.hasMoreTokens())
                return Long.parseLong(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextLong();
            }
        }

        public String nextString() throws IOException{
            if(st.hasMoreTokens())
                return st.nextToken();
            else{
                st = new StringTokenizer(s.readLine());
                return nextString();
            }

        }
        public String readLine() throws IOException{
            return s.readLine();
        }

        public void close() throws IOException{
            s.close();
        }

    }

    ////////////////////////////////////////////////////////////////////
    //      Number Theory

    long pow(long a,long b,long mod){
        long x = 1; long y = a;
        while(b > 0){
            if(b % 2 == 1){
                x = (x*y);
                x %= mod;
            }
            y = (y*y);
            y %= mod;
            b /= 2;
        }
        return x;
    }

    int divisor(long x,long[] a){
        long limit = x;
        int numberOfDivisors = 0;

        for (int i=1; i < limit; ++i) {
            if (x % i == 0) {
                limit = x / i;
                if (limit != i) {
                    numberOfDivisors++;
                }
                numberOfDivisors++;
            }
        }
        return numberOfDivisors;
    }

    void findSubsets(int array[]){

        long numOfSubsets = 1 << array.length;
        for(int i = 0; i < numOfSubsets; i++){

            int pos = array.length - 1;
            int bitmask = i;

            while(bitmask > 0){
                if((bitmask & 1) == 1)
                    ww.print(array[pos]+" ");

                bitmask >>= 1;
                pos--;
            }

            ww.println();
        }
    }

    public static int gcd(int a, int b){
        return b == 0 ? a : gcd(b,a%b);
    }

    public static int lcm(int a,int b, int c){
        return lcm(lcm(a,b),c);
    }

    public static int lcm(int a, int b){
        return a*b/gcd(a,b);
    }

    ////////////////////////////////////////////////////////////////////

//    private static    FastScanner s = new FastScanner(new File("input.txt"));
//    private static PrintWriter ww = new PrintWriter(new FileWriter("output.txt"));
    InputStream inputStream = System.in;
    FastScanner s = new FastScanner(inputStream);
    OutputStream outputStream = System.out;
    PrintWriter ww = new PrintWriter(new OutputStreamWriter(outputStream));
//      private static Scanner s = new Scanner(System.in);
    @SuppressWarnings("unused")
    private static int[][] states = { {-1,0} , {1,0} , {0,-1} , {0,1} };

    ////////////////////////////////////////////////////////////////////

    public static void main(String[] args) throws IOException{
        new Solution().solve();
    }

    ////////////////////////////////////////////////////////////////////

    void solve() throws IOException{

        int n = s.nextInt();
        int key = s.nextInt();
        Integer[] a = new Integer[n];
        for(int i=0;i<n;i++) a[i] = s.nextInt();

        Arrays.sort(a);
        int mid = (n+1)/2;
        int in = Arrays.binarySearch(a, key);

        if(in < 0) ww.println(n+1);
        else{
            in++;
            if(in == mid) ww.println(0);
            else ww.println(mid-in);
        }

        s.close();
        ww.close();
     }

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution{

    ///////////////////////////////////////////////////////////////////////////
    static class FastScanner{
        BufferedReader s;
        StringTokenizer st;

        public FastScanner(InputStream InputStream){
            st = new StringTokenizer("");
            s = new BufferedReader(new InputStreamReader(InputStream));
        }

        public FastScanner(File f) throws FileNotFoundException{
            st = new StringTokenizer("");
            s = new BufferedReader (new FileReader(f));
        }

        public int nextInt() throws IOException{
            if(st.hasMoreTokens())
                return Integer.parseInt(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextInt();
            }
        }

/*      public double nextDouble() throws IOException{
            if(st.hasMoreTokens())
                return Double.parseDouble(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextDouble();
            }
        }
*/
        public long nextLong() throws IOException{
            if(st.hasMoreTokens())
                return Long.parseLong(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextLong();
            }
        }

        public String nextString() throws IOException{
            if(st.hasMoreTokens())
                return st.nextToken();
            else{
                st = new StringTokenizer(s.readLine());
                return nextString();
            }

        }
        public String readLine() throws IOException{
            return s.readLine();
        }

        public void close() throws IOException{
            s.close();
        }

    }

    ////////////////////////////////////////////////////////////////////
    //      Number Theory

    long pow(long a,long b,long mod){
        long x = 1; long y = a;
        while(b > 0){
            if(b % 2 == 1){
                x = (x*y);
                x %= mod;
            }
            y = (y*y);
            y %= mod;
            b /= 2;
        }
        return x;
    }

    int divisor(long x,long[] a){
        long limit = x;
        int numberOfDivisors = 0;

        for (int i=1; i < limit; ++i) {
            if (x % i == 0) {
                limit = x / i;
                if (limit != i) {
                    numberOfDivisors++;
                }
                numberOfDivisors++;
            }
        }
        return numberOfDivisors;
    }

    void findSubsets(int array[]){

        long numOfSubsets = 1 << array.length;
        for(int i = 0; i < numOfSubsets; i++){

            int pos = array.length - 1;
            int bitmask = i;

            while(bitmask > 0){
                if((bitmask & 1) == 1)
                    ww.print(array[pos]+" ");

                bitmask >>= 1;
                pos--;
            }

            ww.println();
        }
    }

    public static int gcd(int a, int b){
        return b == 0 ? a : gcd(b,a%b);
    }

    public static int lcm(int a,int b, int c){
        return lcm(lcm(a,b),c);
    }

    public static int lcm(int a, int b){
        return a*b/gcd(a,b);
    }

    ////////////////////////////////////////////////////////////////////

//    private static    FastScanner s = new FastScanner(new File("input.txt"));
//    private static PrintWriter ww = new PrintWriter(new FileWriter("output.txt"));
    InputStream inputStream = System.in;
    FastScanner s = new FastScanner(inputStream);
    OutputStream outputStream = System.out;
    PrintWriter ww = new PrintWriter(new OutputStreamWriter(outputStream));
//      private static Scanner s = new Scanner(System.in);
    @SuppressWarnings("unused")
    private static int[][] states = { {-1,0} , {1,0} , {0,-1} , {0,1} };

    ////////////////////////////////////////////////////////////////////

    public static void main(String[] args) throws IOException{
        new Solution().solve();
    }

    ////////////////////////////////////////////////////////////////////

    void solve() throws IOException{

            int n = s.nextInt();
            int x = s.nextInt();
            int[] a = new int[n + 1];
            for (int i = 0; i < n; i++)
                a[i] = s.nextInt();

            a[n] = 1000000;
            Arrays.sort(a);
            int med = (n + 1) / 2 - 1;
            int pos = 0;
            long all = 0;
            for (int i = 0; i < n; i++) {
                if (a[i] < x && a[i + 1] > x) {
                    all++;
                    n++;
                    pos = i + 1;
                } else {
                    if (a[i] == x) {
                        pos = i;
                        if (i >= med) {
                            break;
                        }
                    }
                }
            }
            if (pos == 0 && a[0] != x) {
                n++;
                all++;
            }
            med = (n + 1) / 2 - 1;
            while (pos != med) {
                if (pos < med) {
                    pos++;
                }
                all++;
                n++;
                med = (n + 1) / 2 - 1;
            }
            ww.println(all);

        s.close();
        ww.close();
     }

}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution{

    ///////////////////////////////////////////////////////////////////////////
    static class FastScanner{
        BufferedReader s;
        StringTokenizer st;

        public FastScanner(InputStream InputStream){
            st = new StringTokenizer("");
            s = new BufferedReader(new InputStreamReader(InputStream));
        }

        public FastScanner(File f) throws FileNotFoundException{
            st = new StringTokenizer("");
            s = new BufferedReader (new FileReader(f));
        }

        public int nextInt() throws IOException{
            if(st.hasMoreTokens())
                return Integer.parseInt(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextInt();
            }
        }

/*      public double nextDouble() throws IOException{
            if(st.hasMoreTokens())
                return Double.parseDouble(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextDouble();
            }
        }
*/
        public long nextLong() throws IOException{
            if(st.hasMoreTokens())
                return Long.parseLong(st.nextToken());
            else{
                st = new StringTokenizer(s.readLine());
                return nextLong();
            }
        }

        public String nextString() throws IOException{
            if(st.hasMoreTokens())
                return st.nextToken();
            else{
                st = new StringTokenizer(s.readLine());
                return nextString();
            }

        }
        public String readLine() throws IOException{
            return s.readLine();
        }

        public void close() throws IOException{
            s.close();
        }

    }

    ////////////////////////////////////////////////////////////////////
    //      Number Theory

    long pow(long a,long b,long mod){
        long x = 1; long y = a;
        while(b > 0){
            if(b % 2 == 1){
                x = (x*y);
                x %= mod;
            }
            y = (y*y);
            y %= mod;
            b /= 2;
        }
        return x;
    }

    int divisor(long x,long[] a){
        long limit = x;
        int numberOfDivisors = 0;

        for (int i=1; i < limit; ++i) {
            if (x % i == 0) {
                limit = x / i;
                if (limit != i) {
                    numberOfDivisors++;
                }
                numberOfDivisors++;
            }
        }
        return numberOfDivisors;
    }

    void findSubsets(int array[]){

        long numOfSubsets = 1 << array.length;
        for(int i = 0; i < numOfSubsets; i++){

            int pos = array.length - 1;
            int bitmask = i;

            while(bitmask > 0){
                if((bitmask & 1) == 1)
                    ww.print(array[pos]+" ");

                bitmask >>= 1;
                pos--;
            }

            ww.println();
        }
    }

    public static int gcd(int a, int b){
        return b == 0 ? a : gcd(b,a%b);
    }

    public static int lcm(int a,int b, int c){
        return lcm(lcm(a,b),c);
    }

    public static int lcm(int a, int b){
        return a*b/gcd(a,b);
    }

    ////////////////////////////////////////////////////////////////////

//    private static    FastScanner s = new FastScanner(new File("input.txt"));
//    private static PrintWriter ww = new PrintWriter(new FileWriter("output.txt"));
    InputStream inputStream = System.in;
    FastScanner s = new FastScanner(inputStream);
    OutputStream outputStream = System.out;
    PrintWriter ww = new PrintWriter(new OutputStreamWriter(outputStream));
//      private static Scanner s = new Scanner(System.in);
    @SuppressWarnings("unused")
    private static int[][] states = { {-1,0} , {1,0} , {0,-1} , {0,1} };

    ////////////////////////////////////////////////////////////////////

    public static void main(String[] args) throws IOException{
        new Solution().solve();
    }

    ////////////////////////////////////////////////////////////////////

    void solve() throws IOException{

        int n = s.nextInt();
        int key = s.nextInt();
        Integer[] a = new Integer[n];
        for(int i=0;i<n;i++) a[i] = s.nextInt();

        Arrays.sort(a);
        int mid = (n+1)/2;
        int in = Arrays.binarySearch(a, key);

        if(in < 0){
            in = Math.abs(in);
            if(in > n) ww.println(n+1);
            else ww.println(Math.abs(in-mid));
        }else {
            in++;
            if(in > n) ww.println(n+1);
            else ww.println(Math.abs(in-mid));
        }

        s.close();
        ww.close();
     }

}


import java.util.Scanner;

public class ProblemB {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int klein = 0, gleich = 0, gross = 0;

		for (int i = 0; i < N; i++) {
			int x = sc.nextInt();
			if (x < M) klein++;
			else if (x > M) gross++;
			else gleich++;
		}

		int ans = 0;
		if (gleich == 0) {
			ans++;
			while (klein + 1 < gross) { klein++; ans++; }
			while (gross < klein) { gross++; ans++; }
		} else {
			while (gleich != 1) {
				gleich--;
				if (klein < gross) klein++;
				else gross++;
			}
			while (klein + 1 < gross) { klein++; ans++; }
			while (gross < klein) { gross++; ans++; }
		}

		System.out.println(ans);
	}
}


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLoc = items,
                toAdd = 0;

        for(int i=0; i<items; i++){
            int item = input.nextInt();
            if(med == item){
                newMedLoc = i;
                break;
            }else if(med < item){
                newMedLoc = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int total = 2*Math.abs(newMedLoc - currentMedLoc) + toAdd;

        if(items % 2 == 1)
            total -= (newMedLoc >= currentMedLoc ? 0 : 1);
        else
            total -= (newMedLoc <= currentMedLoc ? 0 : 1);

        System.out.println(total);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLoc = items,
                toAdd = 0;

        int[] stuff = new int[items];
        for(int a=0; a<items; a++)
            stuff[a] = input.nextInt();

        for(int i=0; i<items; i++){
            int item = stuff[i];
            if(med == item){
                newMedLoc = i;
                break;
            }else if(med < item){
                newMedLoc = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int total = 2*Math.abs(newMedLoc - currentMedLoc) + toAdd;

        if(items % 2 == 1)
            total -= (newMedLoc >= currentMedLoc ? 0 : 1);
        else
            total -= (newMedLoc <= currentMedLoc ? 0 : 1);

        System.out.println(total);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLocMin = items, newMedLocMax = items,
                toAdd = 0;

        int[] stuff = new int[items];
        for(int a=0; a<items; a++)
            stuff[a] = input.nextInt();

        Arrays.sort(stuff);
//        System.out.println(Arrays.toString(stuff));

        if(stuff[currentMedLoc] == med){
            System.out.println(0);
            System.exit(0);
        }

        for(int i=0; i<items; i++){
            int item = stuff[i];
            if(med == item){
                newMedLocMax = newMedLocMin = i;
                while(++newMedLocMax < stuff.length && item == stuff[newMedLocMax]);
//                newMedLocMax--;
                break;
            }else if(med < item){
                newMedLocMax = newMedLocMin = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int total = 2*Math.abs(newMedLocMin - currentMedLoc) + toAdd;

        if(items % 2 == 1)
            total -= (newMedLocMin >= currentMedLoc ? 0 : 1);
        else
            total -= (newMedLocMin <= currentMedLoc ? 0 : 1);

        int fin = total;

        for(int loc = newMedLocMin; loc < newMedLocMax; loc++){
            total = 2*Math.abs(loc - currentMedLoc) + toAdd;

            if(items % 2 == 1)
                total -= (loc >= currentMedLoc ? 0 : 1);
            else
                total -= (loc <= currentMedLoc ? 0 : 1);

            fin = Math.min(fin, total);
        }
        System.out.println(fin);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLoc = items,
                toAdd = 0;

        int[] stuff = new int[items];
        for(int a=0; a<items; a++)
            stuff[a] = input.nextInt();

        Arrays.sort(stuff);

        for(int i=0; i<items; i++){
            int item = stuff[i];
            if(med == item){
                newMedLoc = i;
                break;
            }else if(med < item){
                newMedLoc = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int total = 2*Math.abs(newMedLoc - currentMedLoc) + toAdd;

        if(items % 2 == 1)
            total -= (newMedLoc >= currentMedLoc ? 0 : 1);
        else
            total -= (newMedLoc <= currentMedLoc ? 0 : 1);

        System.out.println(total);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLoc = items,
                toAdd = 0;

        int[] stuff = new int[items];
        for(int a=0; a<items; a++)
            stuff[a] = input.nextInt();

        Arrays.sort(stuff);

        for(int i=0; i<items; i++){
            int item = stuff[i];
            if(med == item){
                newMedLoc = i;
                while(++newMedLoc < stuff.length && item == stuff[newMedLoc]);
                newMedLoc--;
                break;
            }else if(med < item){
                newMedLoc = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int total = 2*Math.abs(newMedLoc - currentMedLoc) + toAdd;

        if(items % 2 == 1)
            total -= (newMedLoc >= currentMedLoc ? 0 : 1);
        else
            total -= (newMedLoc <= currentMedLoc ? 0 : 1);

        System.out.println(total);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLocMin = items, newMedLocMax = items,
                toAdd = 0;

        int[] stuff = new int[items];
        for(int a=0; a<items; a++)
            stuff[a] = input.nextInt();

        Arrays.sort(stuff);
//        System.out.println(Arrays.toString(stuff));

        if(stuff[currentMedLoc] == med){
            System.out.println(0);
            System.exit(0);
        }

        for(int i=0; i<items; i++){
            int item = stuff[i];
            if(med == item){
                newMedLocMax = newMedLocMin = i;
                while(++newMedLocMax < stuff.length && item == stuff[newMedLocMax]);
//                newMedLocMax--;
                break;
            }else if(med < item){
                newMedLocMax = newMedLocMin = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int fin = Integer.MAX_VALUE;

        for(int loc = newMedLocMin; loc < newMedLocMax; loc++){
            int total = 2*Math.abs(loc - currentMedLoc) + toAdd;

            if(items % 2 == 1)
                total -= (loc >= currentMedLoc ? 0 : 1);
            else
                total -= (loc <= currentMedLoc ? 0 : 1);

            fin = Math.min(fin, total);
        }
        System.out.println(fin);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLoc = items,
                toAdd = 0;

        for(int i=0; i<items; i++){
            int item = input.nextInt();
            if(med == item){
                newMedLoc = i;
                break;
            }else if(med < item){
                newMedLoc = i;
                items++;
                if(newMedLoc <= currentMedLoc)
                    currentMedLoc++;
                toAdd = 1;
                break;
            }
        }

        if(items % 2 == 1)
            System.out.println(2*Math.abs(newMedLoc - currentMedLoc) - (newMedLoc >= currentMedLoc ? 0 : 1) + toAdd);
        else
            System.out.println(2*Math.abs(newMedLoc - currentMedLoc) + toAdd - (newMedLoc <= currentMedLoc ? 0 : 1));

        input.close();
    }

}


import java.io.*;
import java.util.*;
import java.math.*;

public class Median {

    public static void main(String[] args) throws Exception {
        Scanner input = new Scanner(System.in);

        // 0 1 2 3 4 5 6 7
        // 6 => 6 - (items - 6) + (newMedLoc > currentMedLoc ? 1 : 0)

        // 2 4 6 8 10 11 12 14 16 18

        int items = input.nextInt(), med = input.nextInt(),
                currentMedLoc = (items - 1)/2, newMedLoc = items,
                toAdd = 0;

        int[] stuff = new int[items];
        for(int a=0; a<items; a++)
            stuff[a] = input.nextInt();

        Arrays.sort(stuff);

        if(stuff[currentMedLoc] == med){
            System.out.println(0);
            System.exit(0);
        }

        for(int i=0; i<items; i++){
            int item = stuff[i];
            if(med == item){
                newMedLoc = i;
//                while(++newMedLoc < stuff.length && item == stuff[newMedLoc]);
//                newMedLoc--;
                break;
            }else if(med < item){
                newMedLoc = i;
                items++;
                currentMedLoc = (items - 1)/2;
                toAdd = 1;
                break;
            }
        }

        int total = 2*Math.abs(newMedLoc - currentMedLoc) + toAdd;

        if(items % 2 == 1)
            total -= (newMedLoc >= currentMedLoc ? 0 : 1);
        else
            total -= (newMedLoc <= currentMedLoc ? 0 : 1);

        System.out.println(total);

        input.close();
    }

}

/*
6 11
2 4 6 8 10 12

7 11
2 4 6 8 10 11 12

1)
2 5
7
-
7

2)
3 5
4
-
4
*/


import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

	public static void main(String[] argv) {
		new Main().run();
	}

	void run() {

		in = new Scanner(System.in);
		out = new PrintWriter(System.out);

		try {
			solve();
		} finally {
			out.close();
		}
	}

	PrintWriter out;
	Scanner in;

	void solve() {
		int n = in.nextInt();
		int x = in.nextInt();
		ArrayList<Integer> a = new ArrayList<Integer>();
		for (int i = 0; i < n; i++) {
			a.add(in.nextInt());
		}
		Collections.sort(a);
		int cnt = 0;
		while (a.get((a.size() - 1) / 2) != x) {
			cnt++;
			a.add(x);
			Collections.sort(a);
		}
		out.println(cnt);

	}
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int median = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int n=0;
        boolean val = false;
        boolean med=false;
        String nums= key.nextLine();
        key.close();
        Scanner keyboard = new Scanner(nums);
        while(keyboard.hasNextInt()){

            int next = keyboard.nextInt();
//          System.out.println(next);
            if(next==tgtNum){
                val=true;
                if(median%2==1){
                if(n==(median+1/2))med=true;
                }else if(n==median/2)med=true;
            }
            else if(val)index++;
            n++;
        }
        keyboard.close();
//      System.out.println(median+ " " + index);
        if(med)System.out.println(0);
        else if(index>0){
            System.out.println(median-index);
        }
//      else if(index<(median/2))System.out.println(0);
        else{
            System.out.println(median+(median/2));
        }
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && !median(len,index))index=i+1;
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index)){
            if(moves!=0 || index!=0){
                index++;
                len++;
            }
            moves++;

        }
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && !median(len,index))index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present =false;
             }
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index)){
            if(index < (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if(!present && median(len,index))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==501)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[vals.length-1]<tgtNum)index=vals.length+1;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
//                  len++;
                }
            }
            len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==502)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0 &&present)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((index!=0)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(moves!=0||index!=0 || !present){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(moves==501)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
//                  len++;
                }
            }
            len++;
            moves++;
            System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==501)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(((moves!=0||index!=0)&&present) || (!present && vals[0]>tgtNum)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(((moves!=0||index!=0)&&present) || !present){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0&&present) || !present){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(((moves!=0||index!=0)&&present)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[vals.length-1]<tgtNum) index=vals.length+1;
             else if(vals[0]>tgtNum){
                 present=false;
                 index=0;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)||!present){
                    index++;
                    len++;
                }
            }
//          len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==502)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && !median(len,index))index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present =false;
             }
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index)){
            if(moves!=0 || index!=0){
                index++;
                len++;
            }
            moves++;

        }if(!present && median(len,index))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && !median(len,index))index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present =false;
             }
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index)){
            if(index < (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
//          present=true;
        }
        if(!present && median(len,index))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
            if(vals[i]==tgtNum)index=i+1;
        }
//      System.out.println(index + " " + len)
        int moves=0;
        while(!median(len,index)){
            if(moves!=0 || index!=0){
                index++;
                len++;
            }
            moves++;

        }
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int median = key.nextInt();
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int med=0;
        String nums= key.nextLine();
        key.close();
        Scanner keyboard = new Scanner(nums);
        while(keyboard.hasNextInt()){
            int next = keyboard.nextInt();
//          System.out.println(next);
            if(next==tgtNum)med=1;
            else if(med!=0)index++;
        }
        keyboard.close();
//      System.out.println(median+ " " + index);
        if(index>0){
            System.out.println(median-index);
        }else{
            System.out.println(median+(median/2));
        }
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[vals.length-1]<tgtNum)index=vals.length+1;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
//                  len++;
                }
            }
            len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==501)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int median = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int n=0;
        boolean val = false;
        boolean med=false;
        String nums= key.nextLine();
        key.close();
        Scanner keyboard = new Scanner(nums);
        while(keyboard.hasNextInt()){

            int next = keyboard.nextInt();
//          System.out.println(next);
            if(next==tgtNum){
                val=true;
                if(median%2==1){
                if(n==(median+1/2))med=true;
                }else if(n==median/2)med=true;
            }
            else if(val)index++;
            n++;
        }
        keyboard.close();
        System.out.println(median+ " " + index);
        if(med)System.out.println(0);
        else if(index>0){
            System.out.println(median-index);
        }
//      else if(index<(median/2))System.out.println(0);
        else{
            System.out.println(median+(median/2));
        }
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
            if(len%2==0){
                if(len/2==index && vals[index]==tgtNum)index=index;
            }else if (len%2==1){
                if((len+1)/2==index && vals[index]==tgtNum)index=index;
            }else if(vals[i]==tgtNum)index=i+1;
        }
//      System.out.println(index + " " + len)
        int moves=0;
        while(!median(len,index)){
            if(moves!=0 || index!=0){
                index++;
                len++;
            }
            moves++;

        }
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
            System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index))|| vals.length<=1 && index==0)moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0 &&present){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[vals.length-1]<tgtNum) index=vals.length+1;
             else if(vals[0]>tgtNum){
                 present=false;
                 index=0;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)||!present){
                    index++;
                    len++;
                }
            }else len++;
//          len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==502)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present =false;
             }
//           System.out.println(index);
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index)){
            if(index <= (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if(!present && median(len,index))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
//                  len++;
                }
            }
            len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==501)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }else if(vals[0]>tgtNum || vals[vals.length-1]<tgtNum)present=false;
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
            else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0 &&present) || !present){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
//      System.out.println(index + " " + len);
        int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index))|| vals.length<=1 && index==0)moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
	public static void main(String[] args){
		Scanner key=new Scanner(System.in);
		int median = key.nextInt();
		int tgtNum=key.nextInt();
		int index=0;
		int med=0;
		while(key.hasNextInt()){
			if(key.nextInt()==tgtNum)med=1;
			if(med!=0)index++;
		}
		if(index>0){
			System.out.println(median-index);
		}else{
			System.out.println(median+(median/2));
		}
	}
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
//          else if(vals[0]==tgtNum)moves=0;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index <= (len+1)/2){
                if((moves!=0||index!=0)){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
            System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves=1;
        if(tgtNum==1 && moves==501)moves=500;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if(index==(len+1)/2)return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int median = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int n=0;
        boolean val = false;
        boolean med=false;
        String nums= key.nextLine();
        key.close();
        Scanner keyboard = new Scanner(nums);
        while(keyboard.hasNextInt()){

            int next = keyboard.nextInt();
//          System.out.println(next);
            if(next==tgtNum){
                val=true;
                if(median%2==1){
                if(n==((median+1)/2))med=true;
                }else if(n==median/2)med=true;
            }
            else if(val)index++;
            n++;
        }
        keyboard.close();
//      System.out.println(median+ " " + index);
        if(med)System.out.println(0);
        else if(index>0){
            System.out.println(median-index);
        }
//      else if(index<(median/2))System.out.println(0);
        else{
            System.out.println(median+(median/2));
        }
    }
}


import java.util.*;
public class Median {
    public static void main(String[] args){
        Scanner key=new Scanner(System.in);
        int len = key.nextInt();
//      if(median%2==1)median++;
        int tgtNum=key.nextInt();
        key.nextLine();
        int index=0;
        int [] vals = new int[len];
        for(int i=0;i<vals.length;i++){
            vals[i]=key.nextInt();
        }
        Arrays.sort(vals);
        boolean present =true;
//      int close=0;
//      System.out.println(Arrays.toString(vals));
        int moves=0;
        if(vals.length>1){
        for(int i=0;i<vals.length;i++){
             if(vals[i]==tgtNum && median(len,i+1))index=i+1;
             else if(vals[i]==tgtNum && closer(index,i+1,len))index=i+1;
//           else if(vals[i]==tgtNum)index=i+1;
             else if (vals[i]<tgtNum && i<vals.length-1&& vals[i+1]>tgtNum){
                 index=i+1;
                 present=false;
             }
//           System.out.println(index);
        }
        }else{
            if(vals[0]<tgtNum)moves=2;
            else if(vals[0]>tgtNum)moves=1;
        }
//      System.out.println(index + " " + len);
//      int moves=0;
        while(!median(len,index) && vals.length>1){
            if(index < (len+1)/2){
                if(moves!=0||index!=0){
                    index++;
                    len++;
                }
            }else len++;
            moves++;
//          System.out.println(index + " " + len);
            present=true;
        }
        if((!present && median(len,index)))moves++;
        System.out.println(moves);
    }
    public static boolean median(int len, int index){
        if((len%2==1 && (len+1)/2==index) || (len%2==0 && len/2==index))return true;
        return false;
    }
    public static boolean closer(int index, int i, int len){
        int median=(len+1)/2;
        if(index==median)return false;
//      if(i==median)return true;
        if(index<median && i<median)return i>index;
        else if(index>median && i>median)return i<index;
        else if(index<median && i>median)return i-median<median-index;
        else return median-i<index-median;
    }
}