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.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;

public class Main {

    private void solve() {
        int n = in.nextInt();
        int x = in.nextInt();
        Vector<Integer> v = new Vector<>();
        for(int i =0 ; i < n; ++i)
            v.add(in.nextInt());
        Collections.sort(v);
        int save = v.size();
        boolean contains = false;
        for(int y : v)
            contains |= x == y;
        if (!contains) {
            v.add(x);
            Collections.sort(v);
        }

        int r;
        while ((r = median(v)) != x) {
            //out.print(v.toString() + "\n");
            if (r < x) {
                v.add(x+1);
            } else {
                v.add(x-1);
            }
            Collections.sort(v);
        }
        out.print(v.size() - save);
    }
    private int median(Vector<Integer> v) {
        return v.get((v.size() + 1) / 2 - 1);
    }
    private void run() {
        try {
            in = new FastScanner();
            out = new PrintWriter(new OutputStreamWriter(System.out));
            solve();
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new Main().run();
    }
    FastScanner in;
    PrintWriter out;
    class FastScanner {
        public BufferedReader reader;
        private StringTokenizer tokenizer;
        public FastScanner(String file) {
            try {
                reader = new BufferedReader(new FileReader(new File(file)));
                tokenizer = null;
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner() {
            try {
                reader = new BufferedReader(new InputStreamReader(System.in));
                tokenizer = null;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        public String nextToken() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(nextToken());
        }
        long nextLong() {
            return Long.parseLong(nextToken());
        }
    }
}


import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
    public static StringTokenizer st;
    public static BufferedReader scan;
    public static PrintWriter out;
    public static void main(String[] args) throws  IOException{
        scan = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt(), x = nextInt();
        int[] a = new int[n + 1];
        for(int i = 1; i <= n; i++){
            a[i] = nextInt();
        }
        Arrays.sort(a, 1, n + 1);
        //for(int i = 1; i <= n; i++)out.print(a[i] + " ");
        int l = 10000000, r = 10000000;
        for(int i = (n + 1) / 2; i <= n; i++){
           if(a[i] == x){
               r = i;
               break;
           }
        }
        for(int i = (n + 1) / 2; i >= 1; i--){
            if(a[i] == x){
                l = i;
                break;
            }
        }
        int m = (n + 1) / 2;
        if(l == 10000000 && r == 10000000){
             out.println((n&1) == 1 ? (n + 1) : n);
        }else{
           if(Math.abs(m - l) < Math.abs(m - r)){
               out.println((n&1) == 1 ? (l) : (l + 1));
           }else{
               out.println((n&1) == 1 ? (r - m + 1) : (r - m));
           }
        }
        out.close();
        scan.close();
    }

    public static BigDecimal nextBigDecimal() throws  IOException {
        return new BigDecimal(next());
    }
    public static BigInteger nextBigInteger() throws  IOException {
        return new BigInteger(next());
    }
    public static long nextLong() throws  IOException {
        return Long.parseLong(next());
    }
    public static double nextDouble() throws  IOException {
        return Double.parseDouble(next());
    }
    public static int nextInt() throws  IOException {
        return Integer.parseInt(next());
    }
    public static String next() throws IOException {
        while(st == null || !st.hasMoreTokens()){
            st = new StringTokenizer(scan.readLine());
        }
        return st.nextToken();
    }
}


import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
    public static StringTokenizer st;
    public static BufferedReader scan;
    public static PrintWriter out;
    public static void main(String[] args) throws  IOException{
        scan = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt(), x = nextInt();
        Vector <Integer>v = new Vector();
        for(int i = 1; i <= n; i++){
            v.add(nextInt());
        }
        Collections.sort(v);
        int ans = 0;
        while(v.get((n + 1) / 2 - 1) != x){
            v.add(x);
            Collections.sort(v);
            ans++;
            n++;
        }
        out.println(ans);
        out.close();
        scan.close();
    }

    public static BigDecimal nextBigDecimal() throws  IOException {
        return new BigDecimal(next());
    }
    public static BigInteger nextBigInteger() throws  IOException {
        return new BigInteger(next());
    }
    public static long nextLong() throws  IOException {
        return Long.parseLong(next());
    }
    public static double nextDouble() throws  IOException {
        return Double.parseDouble(next());
    }
    public static int nextInt() throws  IOException {
        return Integer.parseInt(next());
    }
    public static String next() throws IOException {
        while(st == null || !st.hasMoreTokens()){
            st = new StringTokenizer(scan.readLine());
        }
        return st.nextToken();
    }
}


import java.util.*;
import java.math.*;
import java.io.*;
public class Main {
    public static StringTokenizer st;
    public static BufferedReader scan;
    public static PrintWriter out;
    public static void main(String[] args) throws  IOException{
        scan = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt(), x = nextInt();
        int[] a = new int[n + 1];
        for(int i = 1; i <= n; i++){
            a[i] = nextInt();
        }
        Arrays.sort(a, 1, n + 1);
        //for(int i = 1; i <= n; i++)out.print(a[i] + " ");
        int l = 10000000, r = 10000000;
        for(int i = (n + 1) / 2; i <= n; i++){
           if(a[i] == x){
               r = i;
               break;
           }
        }
        for(int i = (n + 1) / 2; i >= 1; i--){
            if(a[i] == x){
                l = i;
                break;
            }
        }
        int m = (n + 1) / 2;
        if(l == 10000000 && r == 10000000){
             out.println((n&1) == 1 ? (n + 1) : n);
        }else{
           if(Math.abs(m - l) < Math.abs(m - r)){
               out.println((n&1) == 1 ? (l) : (l + 1));
           }else{
               out.println((n&1) == 1 ? (r - m) : (r - m + 1));
           }
        }
        out.close();
        scan.close();
    }

    public static BigDecimal nextBigDecimal() throws  IOException {
        return new BigDecimal(next());
    }
    public static BigInteger nextBigInteger() throws  IOException {
        return new BigInteger(next());
    }
    public static long nextLong() throws  IOException {
        return Long.parseLong(next());
    }
    public static double nextDouble() throws  IOException {
        return Double.parseDouble(next());
    }
    public static int nextInt() throws  IOException {
        return Integer.parseInt(next());
    }
    public static String next() throws IOException {
        while(st == null || !st.hasMoreTokens()){
            st = new StringTokenizer(scan.readLine());
        }
        return st.nextToken();
    }
}


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

public class middle implements Runnable {
	public StringTokenizer strtok;
	public BufferedReader inr;
	public PrintWriter out;

	public static void main(String[] args) {
		new Thread(new middle()).start();
	}

	public static final String taskname = "middle";

	public void run() {
		Locale.setDefault(Locale.US);
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		try {
			inr = new BufferedReader(oj ? new InputStreamReader(System.in, "ISO-8859-1") : new FileReader(taskname + ".in"));
			out = new PrintWriter(oj ? new OutputStreamWriter(System.out, "ISO-8859-1") : new FileWriter(taskname + ".out"));
			solve();
		} catch (Exception e) {
			if (!oj)
				e.printStackTrace();
			System.exit(9000);
		} finally {
			out.flush();
			out.close();
		}
	}

	public String nextToken() throws IOException {
		while (strtok == null || !strtok.hasMoreTokens()) {
			strtok = new StringTokenizer(inr.readLine());
		}
		return strtok.nextToken();
	}

	public int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	// Debugging

	public static void printArray(boolean[][] a) {
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.print(a[i][j] ? '#' : '.');
			}
			System.out.print('\n');
		}
	}

	// Solution

	public static int lower_bound(ArrayList<Integer> list, int first, int last, int val) {
		int len = last - first;
		int half;
		int middle;
		while (len > 0) {
			half = len >>> 1;
			middle = first + half;
			if (list.get(middle) < val) {
				first = middle + 1;
				len = len - half - 1;
			} else
				len = half;
		}
		return first;
	}

	public static int upper_bound(ArrayList<Integer> list, int first, int last, int val) {
		int len = last - first;
		int half;
		int middle;
		while (len > 0) {
			half = len >>> 1;
			middle = first + half;
			if (val < list.get(middle))
				len = half;
			else {
				first = middle + 1;
				len = len - half - 1;
			}
		}
		return first;
	}

	public void solve() throws NumberFormatException, IOException {
		int n = nextInt();
		int x = nextInt();

		ArrayList<Integer> a = new ArrayList<Integer>(n);

		for (int i = 0; i < n; i++) {
			a.add(nextInt());
		}
		Collections.sort(a);

		int result = 0;
		int med_pos = (n - 1) / 2;
		int val = a.get(med_pos);
		while (val != x) {
			int low = lower_bound(a, 0, n, x);
			int high = upper_bound(a, 0, n, x);

			if (low > med_pos) {
				a.add(low, x);
			}
			else if (high <= med_pos) {
				a.add(high, x);
			}
			else {
				System.out.println(a);
				System.out.printf("%d, %d, %d\n", low, med_pos, high);
				throw new AssertionError();
			}

			med_pos = (a.size() - 1) / 2;
			val = a.get(med_pos);
			result++;
		}
		out.print(result);
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;
import java.util.TreeSet;

public class C {

    static StreamTokenizer st;
    static PrintWriter pw;
    public static void main(String[] args) throws IOException{
        st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n = nextInt();
        int x = nextInt();
        int[]a = new int[10000];
        for (int i = 1; i <= n; i++) {
            a[i] = nextInt();
        }
        Arrays.sort(a, 1, n+1);
        if (a[(n+1)/2]==x) {
            System.out.println(0);
            return;
        }
        TreeSet<Integer> set = new TreeSet<Integer>();
        for (int i = 1; i <= n; i++) {
            set.add(a[i]);
        }
        int ans = 0;
        while (true) {
            if (a[(1+n)/2]==x) {
                System.out.println(ans);
                return;
            }
            ans++;
            if (x >= a[n])
                a[++n] = x;
            else {
                int ind = 0;
                for (int i = 1; i <= n; i++) {
                    if (a[i] >= x) {
                        ind = i;
                        break;
                    }
                }
                n++;
                for (int i = n; i >= ind ; i--) {
                    a[i] = a[i-1];
                }
                a[ind] = x;
            }
        }
    }
    private static int nextInt() throws IOException{
        st.nextToken();
        return (int) st.nval;
    }
}


import java.io.*;
import java.util.*;
public class j
{
public static void main(String aa[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int x=0,i=0,p=0,tr=-1,tl=-1,n=0,k=0;
String s;
s=b.readLine();
StringTokenizer c=new StringTokenizer(s);
n=Integer.parseInt(c.nextToken());
k=Integer.parseInt(c.nextToken());
s=b.readLine();
StringTokenizer z=new StringTokenizer(s);
int d[]=new int[n];
for(i=0;i<n;i++)
d[i]=Integer.parseInt(z.nextToken());
Arrays.sort(d);
if(n%2==0)
p=n/2-1;
else
p=n/2;
if(d[p]==k)
{
System.out.print("0");
System.exit(0);
}
else
{
for(i=p;i>=0;i--)
if(d[i]==k)
tl=i;
for(i=p;i<n;i++)
if(d[i]==k)
tr=i;
if(tr>=0&&tl>=0)
{
if(n%2==1)
{
System.out.print((int)Math.min(2*(p-tl)-1,2*(tr-p)));
}
else
{
System.out.print((int)Math.min(2*(p-tl),2*(tr-p)-1));
}
}
else
{
if(tl>=0)
{
if(n%2==1)
System.out.print(2*(p-tl)-1);
else
System.out.print(2*(p-tl));
}
else
{
if(tr>=0)
{
if(n%2==1)
System.out.print(2*(tr-p));
else
System.out.print(2*(tr-p)-1);
}
else
{
if(k<d[0])
{
if(n%2==0)
{
p++;
System.out.print(2*p);
}
else
System.out.print(2*p+1);
}
if(k>d[n-1])
{
if(n%2==0)
{
p++;
System.out.print(2*(n-p)+1);
}
else
System.out.print(2*(n-p));
}
if(k>d[0]&&k<d[n-1])
{
x=Arrays.binarySearch(d,k);
x=(-1)*x-1;
if(n%2==0)
p++;
if(x==p)
{
System.out.print("1");
System.exit(0);
}
if(x<p)
{
if(n%2==0)
System.out.print(2*(p-x));
else
System.out.print(2*(p-x)+1);
}
if(x>p)
{
if(n%2==0)
System.out.print(2*(x-p)+1);
else
System.out.print(2*(x-p));
}
}
}
}
}
}
}
}


import java.io.*;
import java.util.*;
public class j
{
public static void main(String aa[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int x=0,i=0,p=0,tr=-1,tl=-1,n=0,k=0;
String s;
s=b.readLine();
StringTokenizer c=new StringTokenizer(s);
n=Integer.parseInt(c.nextToken());
k=Integer.parseInt(c.nextToken());
s=b.readLine();
StringTokenizer z=new StringTokenizer(s);
int d[]=new int[n];
for(i=0;i<n;i++)
d[i]=Integer.parseInt(z.nextToken());
Arrays.sort(d);
if(n%2==0)
p=n/2-1;
else
p=n/2;
if(d[p]==k)
{
System.out.print("0");
System.exit(0);
}
else
{
for(i=p;i>=0;i--)
if(d[i]==k)
tl=i;
for(i=p;i<n;i++)
if(d[i]==k)
tr=i;
if(tr>=0&&tl>=0)
{
if(n%2==1)
{
System.out.print((int)Math.min(2*(p-tl)-1,2*(tr-p)));
}
else
{
System.out.print((int)Math.min(2*(p-tl),2*(tr-p)-1));
}
}
else
{
if(tl>=0)
{
if(n%2==1)
System.out.print(2*(p-tl)-1);
else
System.out.print(2*(p-tl));
}
else
{
if(tr>=0)
{
if(n%2==1)
System.out.print(2*(p-tl));
else
System.out.print(2*(p-tl)-1);
}
else
{
if(k<d[0])
{
if(n%2==0)
{
p++;
System.out.print(2*p);
}
else
System.out.print(2*p+1);
}
if(k>d[n-1])
{
if(n%2==0)
{
p++;
System.out.print(2*(n-p)+1);
}
else
System.out.print(2*(n-p));
}
if(k>d[0]&&k<d[n-1])
{
x=Arrays.binarySearch(d,k);
x=(-1)*x-1;
if(n%2==0)
p++;
if(x==p)
{
System.out.print("1");
System.exit(0);
}
if(x<p)
{
if(n%2==0)
System.out.print(2*(p-x));
else
System.out.print(2*(p-x)+1);
}
if(x>p)
{
if(n%2==0)
System.out.print(2*(x-p)+1);
else
System.out.print(2*(x-p));
}
}
}
}
}
}
}
}


import java.io.*;
import java.util.*;
public class j
{
public static void main(String aa[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int x=0,i=0,p=0,tr=-1,tl=-1,n=0,k=0;
String s;
s=b.readLine();
StringTokenizer c=new StringTokenizer(s);
n=Integer.parseInt(c.nextToken());
k=Integer.parseInt(c.nextToken());
s=b.readLine();
StringTokenizer z=new StringTokenizer(s);
int d[]=new int[n];
for(i=0;i<n;i++)
d[i]=Integer.parseInt(z.nextToken());
Arrays.sort(d);
if(n%2==0)
p=n/2-1;
else
p=n/2;
if(d[p]==k)
{
System.out.print("0");
System.exit(0);
}
else
{
for(i=p;i>=0;i--)
if(d[i]==k)
{
tl=i;
break;
}
for(i=p;i<n;i++)
if(d[i]==k)
{
tr=i;
break;
}
if(tr>=0&&tl>=0)
{
if(n%2==1)
{
System.out.print((int)Math.min(2*(p-tl)-1,2*(tr-p)));
}
else
{
System.out.print((int)Math.min(2*(p-tl),2*(tr-p)-1));
}
}
else
{
if(tl>=0)
{
if(n%2==1)
System.out.print(2*(p-tl)-1);
else
System.out.print(2*(p-tl));
}
else
{
if(tr>=0)
{
if(n%2==1)
System.out.print(2*(tr-p));
else
System.out.print(2*(tr-p)-1);
}
else
{
if(k<d[0])
{
if(n%2==0)
{
p++;
System.out.print(2*p);
}
else
System.out.print(2*p+1);
}
if(k>d[n-1])
{
if(n%2==0)
{
p++;
System.out.print(2*(n-p)+1);
}
else
System.out.print(2*(n-p));
}
if(k>d[0]&&k<d[n-1])
{
x=Arrays.binarySearch(d,k);
x=(-1)*x-1;
if(n%2==0)
p++;
if(x==p)
{
System.out.print("1");
System.exit(0);
}
if(x<p)
{
if(n%2==0)
System.out.print(2*(p-x));
else
System.out.print(2*(p-x)+1);
}
if(x>p)
{
if(n%2==0)
System.out.print(2*(x-p)+1);
else
System.out.print(2*(x-p));
}
}
}
}
}
}
}
}


import java.io.*;
import java.util.*;
public class j
{
public static void main(String aa[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int i=0,p=0,tr=-1,tl=-1,n=0,k=0;
String s;
s=b.readLine();
StringTokenizer c=new StringTokenizer(s);
n=Integer.parseInt(c.nextToken());
k=Integer.parseInt(c.nextToken());
s=b.readLine();
StringTokenizer z=new StringTokenizer(s);
int d[]=new int[n];
for(i=0;i<n;i++)
d[i]=Integer.parseInt(z.nextToken());
Arrays.sort(d);
if(n%2==0)
p=n/2-1;
else
p=n/2;
if(d[p]==k)
{
System.out.print("0");
System.exit(0);
}
else
{
for(i=p;i>=0;i--)
if(d[i]==k)
tl=i;
for(i=p;i<n;i++)
if(d[i]==k)
tr=i;
if(tr>=0&&tl>=0)
{
if(n%2==1)
{
System.out.print((int)Math.min(2*(p-tl)-1,2*(tr-p)));
}
else
{
System.out.print((int)Math.min(2*(p-tl),2*(tr-p)-1));
}
}
else
{
if(tl>=0)
{
if(n%2==1)
System.out.print(2*(p-tl)-1);
else
System.out.print(2*(p-tl));
}
else
{
if(tr>=0)
{
if(n%2==1)
System.out.print(2*(p-tl));
else
System.out.print(2*(p-tl)-1);
}
else
{
if(k<d[0])
{
if(n%2==0)
{
p++;
System.out.print(2*p);
}
else
System.out.print(2*p+1);
}
if(k>d[n-1])
{
if(n%2==0)
{
p++;
System.out.print(2*(n-p)+1);
}
else
System.out.print(2*(n-p));
}
}
}
}
}
}
}


import java.io.*;
import java.util.*;
public class j
{
public static void main(String aa[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int i=0,p=0,tr=-1,tl=-1,n=0,k=0;
String s;
s=b.readLine();
StringTokenizer c=new StringTokenizer(s);
n=Integer.parseInt(c.nextToken());
k=Integer.parseInt(c.nextToken());
s=b.readLine();
StringTokenizer z=new StringTokenizer(s);
int d[]=new int[n];
for(i=0;i<n;i++)
d[i]=Integer.parseInt(z.nextToken());
if(n%2==0)
p=n/2-1;
else
p=n/2;
for(i=p;i>=0;i--)
if(d[i]==k)
tl=i;
for(i=p;i<n;i++)
if(d[i]==k)
tr=i;
if(tr>=0&&tl>=0)
{
if(n%2==1)
{
System.out.print((int)Math.min(2*(p-tl)-1,2*(tr-p)));
}
else
{
System.out.print((int)Math.min(2*(p-tl),2*(tr-p)-1));
}
}
else
{
if(tl>=0)
{
if(n%2==1)
System.out.print(2*(p-tl)-1);
else
System.out.print(2*(p-tl));
}
else
{
if(tr>=0)
{
if(n%2==1)
System.out.print(2*(p-tl));
else
System.out.print(2*(p-tl)-1);
}
else
{
if(k<d[0])
{
if(n%2==0)
{
p++;
System.out.print(2*p);
}
else
System.out.print(2*p+1);
}
if(k>d[n-1])
{
if(n%2==0)
{
p++;
System.out.print(2*(n-p)+1);
}
else
System.out.print(2*(n-p));
}
}
}
}
}
}


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

11 3
1 2 2 2 2 2 3 3 3 3 3

13 1
1 1 1 1 2 2 3 3 3 3 3 3 3

13 2
1 1 1 1 2 2 3 3 3 3 3 3 3

12 3
1 1 1 1 2 2 3 3 3 3 3 3

7 3
2 2 4 4 5 6 7

7 8
2 2 4 4 5 6 7

 */
public class Main {
	public static Scanner scan = new Scanner(System.in);
	public static boolean bg = false;

	public static void main(String[] args) throws Exception {
		int n = Integer.parseInt(scan.next());
		int x = Integer.parseInt(scan.next());
		HashMap<Integer,Integer> m1 = new HashMap();
		ArrayList<Integer> l1 = new ArrayList();
		int[] l2 = new int[n];
		for (int i=0;i<n;i++){
			int cur =Integer.parseInt(scan.next());
			int count = 0;
			if (m1.containsKey(cur)) count = m1.get(cur);
			if (!m1.containsKey(cur)) l1 .add(cur);
			m1.put(cur, count+1);
			l2[i]=cur;
		}
		Arrays.sort(l2);
		if (bg) System.out.println(Arrays.toString(l2));
		if (l2[(n+1)/2-1]==x){
			System.out.println(0);
			System.exit(0);
		}

		ArrayList<Integer> cu1 = new ArrayList();
		Collections.sort(l1);
		int total = 0;
		for (int i=0;i<l1.size();i++){
			total+=m1.get(l1.get(i));
			cu1.add(total);
		}

		int id = Collections.binarySearch(l1, x);
		if (bg) System.out.println(m1);
		if (bg) System.out.println(l1);
		if (bg) System.out.println(cu1);

		if (id>=0){
			if (bg) System.out.println("exist");
			int above = 0;
			int below = 0;
			below = cu1.get(id);
			above = total-cu1.get(id);
			if (bg) System.out.println(below +" "+above);
			if (below<above){
				int top = above;
				int low = below-1;
				if (bg) System.out.println("top "+top+" low "+low);
				System.out.println(top-low-1);
			}
			else {
				int top = total-1;
				if (id!=0) top = total-cu1.get(id-1)-1;
				int low = 0;
				if (id!=0) low = cu1.get(id-1);
				if (bg) System.out.println("top "+top+" low "+low);
				System.out.println(low-top);
			}
		}
		else {
			if (bg) System.out.println("exist");
			int above = 0;
			int below = 0;
			int xid = -id-1;
			if (bg) System.out.println("xid "+xid);
			if (xid!=0) below = cu1.get(xid-1);
			above = total-below;
			if (bg) System.out.println("below "+below+" above "+above);
			if (below<above){
				System.out.println(above-below);
			}
			else {
				System.out.println(below-above+1);
			}
		}
	}
}


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

11 3
1 2 2 2 2 2 3 3 3 3 3

13 1
1 1 1 1 2 2 3 3 3 3 3 3 3

13 2
1 1 1 1 2 2 3 3 3 3 3 3 3

12 3
1 1 1 1 2 2 3 3 3 3 3 3

7 3
2 2 4 4 5 6 7

7 8
2 2 4 4 5 6 7

 */
public class Main {
	public static Scanner scan = new Scanner(System.in);
	public static boolean bg = false;

	public static void main(String[] args) throws Exception {
		int n = Integer.parseInt(scan.next());
		int x = Integer.parseInt(scan.next());
		HashMap<Integer,Integer> m1 = new HashMap();
		ArrayList<Integer> l1 = new ArrayList();
		int[] l2 = new int[n];
		for (int i=0;i<n;i++){
			int cur =Integer.parseInt(scan.next());
			int count = 0;
			if (m1.containsKey(cur)) count = m1.get(cur);
			if (!m1.containsKey(cur)) l1 .add(cur);
			m1.put(cur, count+1);
			l2[i]=cur;
		}
		if (l2[(n+1)/2-1]==x){
			System.out.println(0);
			System.exit(0);
		}

		ArrayList<Integer> cu1 = new ArrayList();
		Collections.sort(l1);
		int total = 0;
		for (int i=0;i<l1.size();i++){
			total+=m1.get(l1.get(i));
			cu1.add(total);
		}

		int id = Collections.binarySearch(l1, x);
		if (bg) System.out.println(m1);
		if (bg) System.out.println(l1);
		if (bg) System.out.println(cu1);

		if (id>=0){
			if (bg) System.out.println("exist");
			int above = 0;
			int below = 0;
			below = cu1.get(id);
			above = total-cu1.get(id);
			if (bg) System.out.println(below +" "+above);
			if (below<above){
				int top = above;
				int low = below-1;
				if (bg) System.out.println("top "+top+" low "+low);
				System.out.println(top-low-1);
			}
			else {
				int top = total-1;
				if (id!=0) top = total-cu1.get(id-1)-1;
				int low = 0;
				if (id!=0) low = cu1.get(id-1);
				if (bg) System.out.println("top "+top+" low "+low);
				System.out.println(low-top);
			}
		}
		else {
			if (bg) System.out.println("exist");
			int above = 0;
			int below = 0;
			int xid = -id-1;
			if (bg) System.out.println("xid "+xid);
			if (xid!=0) below = cu1.get(xid-1);
			above = total-below;
			if (bg) System.out.println("below "+below+" above "+above);
			if (below<above){
				System.out.println(above-below);
			}
			else {
				System.out.println(below-above+1);
			}
		}
	}
}


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

11 3
1 2 2 2 2 2 3 3 3 3 3

13 1
1 1 1 1 2 2 3 3 3 3 3 3 3

13 2
1 1 1 1 2 2 3 3 3 3 3 3 3

12 3
1 1 1 1 2 2 3 3 3 3 3 3

7 3
2 2 4 4 5 6 7

7 8
2 2 4 4 5 6 7

 */
public class Main {
	public static Scanner scan = new Scanner(System.in);
	public static boolean bg = false;

	public static void main(String[] args) throws Exception {
		int n = Integer.parseInt(scan.next());
		int x = Integer.parseInt(scan.next());
		HashMap<Integer,Integer> m1 = new HashMap();
		ArrayList<Integer> l1 = new ArrayList();
		int[] l2 = new int[n];
		for (int i=0;i<n;i++){
			int cur =Integer.parseInt(scan.next());
			int count = 0;
			if (m1.containsKey(cur)) count = m1.get(cur);
			if (!m1.containsKey(cur)) l1 .add(cur);
			m1.put(cur, count+1);
			l2[i]=cur;
		}
		if (l2[(n+1)/2-1]==x){
			System.out.println(0);
			System.exit(0);
		}

		ArrayList<Integer> cu1 = new ArrayList();
		Collections.sort(l1);
		int total = 0;
		for (int i=0;i<l1.size();i++){
			total+=m1.get(l1.get(i));
			cu1.add(total);
		}

		int id = Collections.binarySearch(l1, x);
		if (bg) System.out.println(m1);
		if (bg) System.out.println(l1);
		if (bg) System.out.println(cu1);

		if (id>=0){
			if (bg) System.out.println("exist");
			int above = 0;
			int below = 0;
			below = cu1.get(id);
			above = total-cu1.get(id);
			if (bg) System.out.println(below +" "+above);
			if (below<above){
				int top = above;
				int low = below-1;
				if (bg) System.out.println("top "+top+" low "+low);
				System.out.println(top-low-1);
			}
			else {
				int top = total-cu1.get(id-1)-1;
				int low = cu1.get(id-1);
				if (bg) System.out.println("top "+top+" low "+low);
				System.out.println(low-top);
			}
		}
		else {
			if (bg) System.out.println("exist");
			int above = 0;
			int below = 0;
			int xid = -id-1;
			if (bg) System.out.println("xid "+xid);
			if (xid!=0) below = cu1.get(xid-1);
			above = total-below;
			if (bg) System.out.println("below "+below+" above "+above);
			if (below<above){
				System.out.println(above-below);
			}
			else {
				System.out.println(below-above+1);
			}
		}
	}
}


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

public class Main implements Runnable {

	public void solve() throws IOException {
		int N = nextInt();
                int median = nextInt();
                int[] a = new int[N];
                for(int i = 0; i < N; i++) a[i] = nextInt();

                Arrays.sort(a);
                int ind = Arrays.binarySearch(a, median);
                if(ind >= 0){
                        int result = 0;
                        int l = 0, g = 0, e = 0;
                        for(int i = 0; i< N; i++) if(a[i] < median) l++; else if(a[i] > median) g++; else e++;
                        int min = Math.min(g, l);
                        g -= min;
                        l -= min;

                        if(l == 0){
                                result += Math.max(0,  g - e);
                        }
                        else{
                                result += Math.max(0, l - e + 1);
                        }
                        System.out.println(result);
                }
                else{
                        int result = 1;
                        int l = 0, g = 0;
                        for(int i = 0; i < N; i++) if(a[i] < median) l++; else g++;
                        if(l > g){
                                result += l - g;
                        }
                        else if(g > l){
                               result += g - l - 1;
                        }

                        System.out.println(result);
                }
	}

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

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			tok = null;
			solve();
			in.close();
		} catch (IOException e) {
			System.exit(0);
		}
	}

	public String nextToken() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	public long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	public double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	BufferedReader in;
	StringTokenizer tok;
}


import java.util.Scanner;

public class median {
	public static void main(String[] args){

		int[] arr = new int[1001];
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();

		boolean placed = false;
		boolean contained = false;

		int dest = 0;
		for(int i = 0; i < n; i++){
			int cur = sc.nextInt();
			if(x > cur && !placed){
				arr[i] = x;
				dest = i;
				placed = true;
				i++;
			}
			if(x == cur){
				contained = true;
				dest = i;
				arr[i] = cur;
			}
		}
		int res;
		if(!contained){
			res = Math.abs(dest - ((n+1)/2));
		}else{
			res = Math.abs(dest - (n/2));
		}
		System.out.println(res);

	}

}


import java.util.*;
public class Median{
   public static void main(String[] Args){
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int m = sc.nextInt();
      int b = 0;
      int a = 0;
      for(int k =0;k<n;k++){
         int t = sc.nextInt();
         if(t<m)
            a++;
         else if(t>m)
            b++;
      }
      int g = n-(a+b);
      int ans = Math.max(b*2-n, a*2-n+1);
      ans = Math.max(0,ans);
      System.out.println(ans);
   }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;

public class Solution {

	long modd = 1000000007l;

	long[][] mult(long[][] a, long[][] b) {
		long[][] res = new long[4][4];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < 4; k++) {
					res[i][j] = (res[i][j] + a[i][k] * b[k][j]) % modd;
				}
			}
		}
		return res;
	}

	void solve() throws Exception {
		int n = nextInt(), x = nextInt();
		int[] a = new int[n + 1];
		boolean f = true;
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
			if (a[i] == x) f = false;
		}
		int q = 0;
		if (f) {
			a[n++] = x;
			q = 1;
		}
		Arrays.sort(a, 0, n);
		int ans = Integer.MAX_VALUE;
		int m = (n - 1) / 2;
		for (int i = 0; i < n; i++) if (a[i] == x) {
			int tmp;
			if (i <= m)
				if (n % 2 == 0)
					tmp = (m - i) * 2;
				else
					tmp = Math.max(0, (m - i) * 2 - 1);
			else
				if (n % 2 == 0)
					tmp = Math.max(0, (i - m) * 2 - 1);
				else
					tmp = (i - m) * 2;
			ans = Math.min(ans, tmp);
		}
		out.println(ans + q);
	}

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

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}

	String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null) return null;
			st = new StringTokenizer(s);
		}
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;

public class Solution {

	long modd = 1000000007l;

	long[][] mult(long[][] a, long[][] b) {
		long[][] res = new long[4][4];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < 4; k++) {
					res[i][j] = (res[i][j] + a[i][k] * b[k][j]) % modd;
				}
			}
		}
		return res;
	}

	void solve() throws Exception {
		int n = nextInt(), x = nextInt();
		int m = (n - 1) / 2;
		int[] a = new int[n + 1];
		boolean f = true;
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
			if (a[i] == x) f = false;
		}
		int q = 0;
		if (f) {
			a[n++] = x;
			q = 1;
		}
		Arrays.sort(a, 0, n);
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) if (a[i] == x) {
			int tmp;
			if (i <= m)
				if (n % 2 == 0)
					tmp = (m - i) * 2;
				else
					tmp = (m - i) * 2 - 1;
			else
				if (n % 2 == 0)
					tmp = (i - m) * 2 - 1;
				else
					tmp = (i - m) * 2;
			ans = Math.min(ans, tmp);
		}
		out.println(ans + q);
	}

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

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}

	String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null) return null;
			st = new StringTokenizer(s);
		}
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.Vector;

public class Solution {

	long modd = 1000000007l;

	long[][] mult(long[][] a, long[][] b) {
		long[][] res = new long[4][4];
		for (int i = 0; i < 4; i++) {
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < 4; k++) {
					res[i][j] = (res[i][j] + a[i][k] * b[k][j]) % modd;
				}
			}
		}
		return res;
	}

	void solve() throws Exception {
		int n = nextInt(), x = nextInt();
		int m = (n - 1) / 2;
		int[] a = new int[n + 1];
		boolean f = true;
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
			if (a[i] == x) f = false;
		}
		int q = 0;
		if (f) {
			a[n++] = x;
			q = 1;
		}
		Arrays.sort(a, 0, n);
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < n; i++) if (a[i] == x) {
			int tmp;
			if (i <= m)
				if (n % 2 == 0)
					tmp = (m - i) * 2;
				else
					tmp = Math.max(0, (m - i) * 2 - 1);
			else
				if (n % 2 == 0)
					tmp = Math.max(0, (i - m) * 2 - 1);
				else
					tmp = (i - m) * 2;
			ans = Math.min(ans, tmp);
		}
		out.println(ans + q);
	}

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

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		} finally {
			out.close();
		}
	}

	String nextToken() throws Exception {
		while (st == null || !st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null) return null;
			st = new StringTokenizer(s);
		}
		return st.nextToken();
	}

	int nextInt() throws Exception {
		return Integer.parseInt(nextToken());
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st;

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			while (beginInsertIndex < n && a.get(endInsertIndex) <= x) {
				beginInsertIndex++;
			}

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n + 1 - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			while (endInsertIndex < n && a.get(endInsertIndex) <= x) {
				endInsertIndex++;
			}

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n + 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				retVal = Math.max(0, bigger - smaller - equal)
						+ Math.max(0, smaller - bigger - equal);
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (equal % 2 == 0) {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				} else {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal) + 1;
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal = 0;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (smaller + equal < bigger) {
					retVal = bigger - smaller - equal;
				}
				// 1 1 8 => 7
				if (bigger + equal <= smaller) {
					retVal = smaller - bigger - equal + 1;
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (equal % 2 == 0) {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				} else {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal) + 1;
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal) + 1;
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (equal % 2 == 0) {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				} else {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal + 1)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			beginInsertIndex++;
			while (endInsertIndex < n && a.get(endInsertIndex) <= x) {
				endInsertIndex++;
			}
			endInsertIndex++;

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n + 2 - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			beginInsertIndex++;
			while (endInsertIndex < n && a.get(endInsertIndex) <= x) {
				endInsertIndex++;
			}
			endInsertIndex++;

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 < endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n + 3 - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			while (endInsertIndex < n && a.get(endInsertIndex) <= x) {
				endInsertIndex++;
			}

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				// smaller + equal >= bigger
				// bigger + equal > smaller

				// 8 + 1 >= 1
				// 1 + 1 >= 8

				// smaller - 8
				// equal - 1
				// bigger - 1

				// smaller < (n+1)/2
				// bigger

				// 1 2 4 4

				retVal = Math.max(0, smaller + equal - bigger)
						+ Math.max(0, bigger + equal - smaller - 1);

			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (equal % 2 == 0) {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				} else {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal + 1)
									+ Math.max(0, smaller - bigger - equal + 1);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			if (equal == 0) {
				int retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				int retVal = Math.max(0, bigger - smaller - equal)
						+ Math.max(0, smaller - bigger - equal);
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			while (endInsertIndex < n && a.get(endInsertIndex) <= x) {
				endInsertIndex++;
			}

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n + 1 - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (equal % 2 == 0) {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				} else {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal + 1)
									+ Math.max(0, smaller - bigger - equal + 1);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal + 1)
									+ Math.max(0, smaller - bigger - equal + 1);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (equal % 2 == 0) {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				} else {
					if (bigger % 2 == 0) {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					} else {
						if (smaller % 2 == 0) {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal) + 1;
						} else {
							retVal = Math.max(0, bigger - smaller - equal)
									+ Math.max(0, smaller - bigger - equal);
						}
					}
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			beginInsertIndex++;
			while (endInsertIndex < n && a.get(endInsertIndex) <= x) {
				endInsertIndex++;
			}
			endInsertIndex++;

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n + 3 - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			int smaller = 0;
			int equal = 0;
			int bigger = 0;

			for (int i : a) {
				if (i < x) {
					smaller++;
				}
				if (i == x) {
					equal++;
				}
				if (i > x) {
					bigger++;
				}
			}

			int retVal = -1;

			if (equal == 0) {
				retVal = 1 + 2 * Math.max(smaller, bigger) - n;
			} else {
				if (smaller + equal < bigger) {
					retVal = bigger - smaller - equal;
				}
				// 1 1 8 => 7
				if (bigger + equal <= smaller) {
					retVal = smaller - bigger - equal + 1;
				}
			}
			pw.println(retVal);
			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			Collections.sort(a);

			int beginInsertIndex = 0;
			int endInsertIndex = 0;

			while (beginInsertIndex < n && a.get(beginInsertIndex) < x) {
				beginInsertIndex++;
			}
			while (beginInsertIndex < n && a.get(endInsertIndex) <= x) {
				beginInsertIndex++;
			}

			if (beginInsertIndex <= (n + 1) / 2
					&& (n + 1) / 2 <= endInsertIndex) {
				pw.println("0");
				pw.flush();
				s.close();
				return;
			}

			if ((n + 1) / 2 < beginInsertIndex) {
				pw.println(2 * beginInsertIndex - n - 1);
				pw.flush();
				s.close();
				return;
			}

			if (endInsertIndex < (n + 1) / 2) {
				pw.println(n - 2 * endInsertIndex);
				pw.flush();
				s.close();
				return;
			}

			pw.flush();
			s.close();
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Task166C {

	public static void main(String... args) throws NumberFormatException,
			IOException {
		Solution.main(System.in, System.out);
	}

	static class Solution {

		public static void main(InputStream is, OutputStream os)
				throws NumberFormatException, IOException {
			PrintWriter pw = new PrintWriter(os);
			Scanner s = new Scanner(is);

			int n = s.nextInt();
			int x = s.nextInt();

			int retVal = 0;

			ArrayList<Integer> a = new ArrayList<>(n);

			for (int i = 0; i < n; i++) {
				a.add(s.nextInt());
			}

			if (!a.contains(Integer.valueOf(x))) {
				a.add(x);
				retVal++;
			}

			Collections.sort(a);

			while (a.get((a.size() + 1) / 2 - 1) != x) {
				if (a.get((a.size() + 1) / 2 - 1) < x) {
					a.add(Integer.MAX_VALUE);
					retVal++;
				} else {
					a.add(0,Integer.MIN_VALUE);
					retVal++;
				}
			}

			pw.println(retVal);

			pw.flush();
			s.close();
		}
	}

}


import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeSet;

public class c {
	static class Pair {
		int val;
		int uniq;

		Pair(int val, int uniq) {
			this.val = val;
			this.uniq = uniq;
		}

		@Override
		public String toString() {
			return val + " " + uniq;
		}
	}

	static int unique = 1;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		TreeSet<Pair> set = new TreeSet<Pair>(new Comparator<Pair>() {
			@Override
			public int compare(Pair o1, Pair o2) {
				if (o1.val != o2.val)
					return o1.val - o2.val;
				else
					return o1.uniq - o2.uniq;
			}
		});
		for (int i = 0; i < n; i++) {
			set.add(new Pair(sc.nextInt(), unique++));
		}
		//System.out.println(set);
		int lesser = set.headSet(new Pair(x, 0), false).size();
		int greater = set.tailSet(new Pair(x, Integer.MAX_VALUE), false).size();
		int mid = set.size() - lesser - greater;
		int median = (set.size() + 1) / 2;
		//System.out.println(lesser + " " + mid + " " + greater);
		if (lesser + mid < median) {
			System.out.println(greater - (lesser + mid));
		} else if (lesser >= mid + greater) {
			System.out.println((lesser + 1) - (greater + mid));
		} else {
			System.out.println(0);
		}
	}
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int sum[20000];
int tmp[20000];
int n, k, m, j, A, B, C, ans;
int b[200][200];
int a[200][200];

void Pr()
{
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			sum[i] += b[i][j];
		}
	}

	for(int i1 = 0; i1 < n; i1++)
		for(int i2 = i1 + 1; i2 < n; i2++)
			{
				if((i1 != n - 1) && (i2 != n - 1))
				{
        			int sum1 = 0;
        			int sum2 = 0;
        			int sum3 = 0;

        			for(int i = 0; i <= i1; i++)
        				sum1 += sum[i];

        			for(int i = i1 + 1; i <= i2; i++)
        				sum2 += sum[i];

        			for(int i = i2 + 1; i < n; i++)
        				sum3 += sum[i];

        			//cout << i1 << " " << i2 << " " << sum1 << " !" << A << "! " << sum2 << " !" << B << "! " << sum3 << " !" << C << "! " << endl;

        			if((sum1 == A && sum2 == B && sum3 == C) ||
        			   (sum1 == A && sum2 == C && sum3 == B) ||
        			   (sum1 == B && sum2 == A && sum3 == C) ||
        			   (sum1 == B && sum2 == C && sum3 == A) ||
        			   (sum1 == C && sum2 == A && sum3 == B) ||
        			   (sum1 == C && sum2 == B && sum3 == A))
        				ans++;
				}
			}
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	cin >> n >> m;

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			cin >> b[i][j];
			a[i][j] = b[i][j];
		}
	}

	cin >> A >> B >> C;

	Pr();

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			b[j][i] = a[i][j];
		}
	}

	for(int i = 0; i < 20000; i++)
		sum[i] = 0;
	int tmp = n;
	n = m;
	m = tmp;

	Pr();

	cout << ans;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int sum[20000];
int tmp[20000];
int n, k, m, j, A, B, C, ans;
int b[200][200];
int a[200][200];

void Pr()
{
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			sum[i] += b[i][j];
		}
	}

	for(int i1 = 0; i1 < n; i1++)
		for(int i2 = i1 + 1; i2 < n; i2++)
			{
				int sum1 = 0;
				int sum2 = 0;
				int sum3 = 0;

				for(int i = 0; i <= i1; i++)
					sum1 += sum[i];

				for(int i = i1 + 1; i <= i2; i++)
					sum2 += sum[i];

				for(int i = i2 + 1; i < n; i++)
					sum3 += sum[i];

				//cout << i1 << " " << i2 << " " << sum1 << " !" << A << "! " << sum2 << " !" << B << "! " << sum3 << " !" << C << "! " << endl;

				if((sum1 == A && sum2 == B && sum3 == C) ||
				   (sum1 == A && sum2 == C && sum3 == B) ||
				   (sum1 == B && sum2 == A && sum3 == C) ||
				   (sum1 == B && sum2 == C && sum3 == A) ||
				   (sum1 == C && sum2 == A && sum3 == B) ||
				   (sum1 == C && sum2 == B && sum3 == A))
					ans++;
			}
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	cin >> n >> m;

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			cin >> b[i][j];
			a[i][j] = b[i][j];
		}
	}

	cin >> A >> B >> C;

	Pr();

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			b[i][j] = a[j][i];
		}
	}

	for(int i = 0; i < 20000; i++)
		sum[i] = 0;

	Pr();

	cout << ans;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int sum[20000];
int tmp[20000];
int n, k, m, j, A, B, C, ans;
int b[200][200];
int a[200][200];

void Pr()
{
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			sum[i] += b[i][j];
		}
	}

	for(int i1 = 0; i1 < n; i1++)
		for(int i2 = i1 + 1; i2 < n; i2++)
			{
				if((i1 != n) && (i2 != n))
				{
        			int sum1 = 0;
        			int sum2 = 0;
        			int sum3 = 0;

        			for(int i = 0; i <= i1; i++)
        				sum1 += sum[i];

        			for(int i = i1 + 1; i <= i2; i++)
        				sum2 += sum[i];

        			for(int i = i2 + 1; i < n; i++)
        				sum3 += sum[i];

        			//cout << i1 << " " << i2 << " " << sum1 << " !" << A << "! " << sum2 << " !" << B << "! " << sum3 << " !" << C << "! " << endl;

        			if((sum1 == A && sum2 == B && sum3 == C) ||
        			   (sum1 == A && sum2 == C && sum3 == B) ||
        			   (sum1 == B && sum2 == A && sum3 == C) ||
        			   (sum1 == B && sum2 == C && sum3 == A) ||
        			   (sum1 == C && sum2 == A && sum3 == B) ||
        			   (sum1 == C && sum2 == B && sum3 == A))
        				ans++;
				}
			}
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	cin >> n >> m;

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			cin >> b[i][j];
			a[i][j] = b[i][j];
		}
	}

	cin >> A >> B >> C;

	Pr();

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			b[j][i] = a[i][j];
		}
	}

	for(int i = 0; i < 20000; i++)
		sum[i] = 0;
	int tmp = n;
	n = m;
	m = tmp;

	Pr();

	cout << ans;
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>

using namespace std;

int sum[20000];
int tmp[20000];
int n, k, m, j, A, B, C, ans;
int b[200][200];
int a[200][200];

void Pr()
{
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			sum[i] += b[i][j];
		}
	}

	for(int i1 = 0; i1 < n; i1++)
		for(int i2 = i1 + 1; i2 < n; i2++)
			{
				int sum1 = 0;
				int sum2 = 0;
				int sum3 = 0;

				for(int i = 0; i <= i1; i++)
					sum1 += sum[i];

				for(int i = i1 + 1; i <= i2; i++)
					sum2 += sum[i];

				for(int i = i2 + 1; i < n; i++)
					sum3 += sum[i];

				//cout << i1 << " " << i2 << " " << sum1 << " !" << A << "! " << sum2 << " !" << B << "! " << sum3 << " !" << C << "! " << endl;

				if((sum1 == A && sum2 == B && sum3 == C) ||
				   (sum1 == A && sum2 == C && sum3 == B) ||
				   (sum1 == B && sum2 == A && sum3 == C) ||
				   (sum1 == B && sum2 == C && sum3 == A) ||
				   (sum1 == C && sum2 == A && sum3 == B) ||
				   (sum1 == C && sum2 == B && sum3 == A))
					ans++;
			}
}

int main()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);

	cin >> n >> m;

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			cin >> b[i][j];
			a[i][j] = b[i][j];
		}
	}

	cin >> A >> B >> C;

	Pr();

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			b[j][i] = a[i][j];
		}
	}

	for(int i = 0; i < 20000; i++)
		sum[i] = 0;
	int tmp = n;
	n = m;
	m = tmp;

	Pr();

	cout << ans;
	return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int main() {
    //freopen("A.ts.in","r",stdin);
    int n, m, a,b,c, sum, x, y, z, cnt, sumtoi, sumtoj, sumtok;
    vector<int> v;
    vector<int> vx;
    vector<int> vy;
    cin >> n >> m;
    cnt = 0;
    int field [n+1][m+1];
    memset(field, 0, sizeof(field));
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> a;
            field[i][j] = a;
            field[i][m] += a;
            field[n][j] += a;
            field[n][m] += a;
        }
    }

    cin >> a >> b >> c;
    v.push_back(a); v.push_back(b); v.push_back(c);
    sort(v.begin(), v.end());

    //vertical split
    if (m >= 3) {
        for (int i = 1; i <= m-2; ++i)
        {
            for (int j = i+1; j <= m-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                vector<int> vx;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[n][k];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[n][k];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;

            }
        }
    }
    if (n >= 3){
        for (int i = 1; i <= n-2; ++i)
        {
            for (int j = i+1; j <= n-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                vector<int> vx;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[k][m];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[k][m];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;

            }
        }
    }

    printf("%d\n", cnt);
    return 0;
}


    #include <stdio.h>
    #include <iostream>
    #include <string>
    #include <string.h>
    #include <algorithm>
    #include <math.h>
    #include <vector>
    using namespace std;

    int main() {
        int n, m, a,b,c, sum, x, y, z, cnt, sumtoi, sumtoj, sumtok;
        vector<int> v;
        vector<int> vx;
        vector<int> vy;
        cin >> n >> m;
        cnt = 0;
        int field [n+1][m+1];
        memset(field, 0, sizeof(field));
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < m; ++j)
            {
                cin >> a;
                field[i][j] = a;
                field[i][m] += a;
                field[n][j] += a;
                field[n][m] += a;
            }
        }

        cin >> a >> b >> c;
        v.push_back(a); v.push_back(b); v.push_back(c);
        sort(v.begin(), v.end());

        //vertical split
        if (m >= 3) {
            for (int i = 1; i <= m-2; ++i)
            {
                for (int j = i+1; j <= m-1; ++j)
                {
                    sumtoi = 0;
                    sumtoj = 0;
                    sumtok = 0;
                    vector<int> vx;
                    //to i
                    for (int k = 0; k < i; ++k)
                    {
                        sumtoi += field[n][k];
                    }

                    //from i to j
                    for (int k = i; k < j; ++k)
                    {
                        sumtoj += field[n][k];
                    }

                    sumtok = field[n][m] - sumtoi - sumtoj;
                    vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                    sort(vx.begin(), vx.end());

                    if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                        cnt++;

                }
            }
        }
        if (n >= 3){
            for (int i = 1; i <= n-2; ++i)
            {
                for (int j = i+1; j <= n-1; ++j)
                {
                    sumtoi = 0;
                    sumtoj = 0;
                    sumtok = 0;
                    vector<int> vx;
                    //to i
                    for (int k = 0; k < i; ++k)
                    {
                        sumtoi += field[k][m];
                    }

                    //from i to j
                    for (int k = i; k < j; ++k)
                    {
                        sumtoj += field[k][m];
                    }

                    sumtok = field[n][m] - sumtoi - sumtoj;
                    vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                    sort(vx.begin(), vx.end());

                    if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                        cnt++;

                }
            }
        }

        printf("%d\n", cnt);
        return 0;
    }


#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

int field [60][60];
vector<int> v;
vector<int> vx;

int main() {
    // freopen("A.ts.in","r",stdin);
    int n, m, a,b,c, sum, x, y, z, cnt, sumtoi, sumtoj, sumtok;
    cin >> n >> m;
    cnt = 0;
    // memset(field, 0, sizeof(field));
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= m; ++j)
        {
            field[i][j] = 0;
        }
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> a;
            field[i][j] = a;
            field[i][m] += a;
            field[n][j] += a;
            field[n][m] += a;
        }
    }

    cin >> a >> b >> c;
    v.push_back(a); v.push_back(b); v.push_back(c);
    sort(v.begin(), v.end());

    //vertical split
    if (m >= 3) {
        for (int i = 1; i <= m-2; ++i)
        {
            for (int j = i+1; j <= m-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[n][k];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[n][k];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear();
            }
        }
    }
    if (n >= 3){
        for (int i = 1; i <= n-2; ++i)
        {
            for (int j = i+1; j <= n-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[k][m];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[k][m];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear();

            }
        }
    }

    printf("%d\n", cnt);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

int main() {
    int n, m, a,b,c, sum, x, y, z, cnt, sumtoi, sumtoj, sumtok;
    vector<int> v;
    vector<int> vx;
    vector<int> vy;
    cin >> n >> m;
    cnt = 0;
    int field [n+1][m+1];
    memset(field, 0, sizeof(field));
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> a;
            field[i][j] = a;
            field[i][m] += a;
            field[n][j] += a;
            field[n][m] += a;
        }
    }

    cin >> a >> b >> c;
    v.push_back(a); v.push_back(b); v.push_back(c);
    sort(v.begin(), v.end());

    //vertical split
    vector<int> vx;
    if (m >= 3) {
        for (int i = 1; i <= m-2; ++i)
        {
            for (int j = i+1; j <= m-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[n][k];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[n][k];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear()
            }
        }
    }
    if (n >= 3){
        for (int i = 1; i <= n-2; ++i)
        {
            for (int j = i+1; j <= n-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[k][m];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[k][m];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear()

            }
        }
    }

    printf("%d\n", cnt);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

int field [60][60];
vector<int> v;
vector<int> vx;

int main() {
    // freopen("A.ts.in","r",stdin);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int n, m, a,b,c, sum, x, y, z, cnt, sumtoi, sumtoj, sumtok;
    cin >> n >> m;
    cnt = 0;
    // memset(field, 0, sizeof(field));
    for (int i = 0; i <= n; ++i)
    {
        for (int j = 0; j <= m; ++j)
        {
            field[i][j] = 0;
        }
    }

    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> a;
            field[i][j] = a;
            field[i][m] += a;
            field[n][j] += a;
            field[n][m] += a;
        }
    }

    cin >> a >> b >> c;
    v.push_back(a); v.push_back(b); v.push_back(c);
    sort(v.begin(), v.end());

    //vertical split
    if (m >= 3) {
        for (int i = 1; i <= m-2; ++i)
        {
            for (int j = i+1; j <= m-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[n][k];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[n][k];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear();
            }
        }
    }
    if (n >= 3){
        for (int i = 1; i <= n-2; ++i)
        {
            for (int j = i+1; j <= n-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[k][m];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[k][m];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear();

            }
        }
    }

    printf("%d\n", cnt);
    return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
#include <algorithm>
#include <math.h>
#include <vector>

using namespace std;

int main() {
    //freopen("A.ts.in","r",stdin);
    int n, m, a,b,c, sum, x, y, z, cnt, sumtoi, sumtoj, sumtok;
    vector<int> v;
    vector<int> vx;
    vector<int> vy;
    cin >> n >> m;
    cnt = 0;
    int field [n+1][m+1];
    memset(field, 0, sizeof(field));
    for (int i = 0; i < n; ++i)
    {
        for (int j = 0; j < m; ++j)
        {
            cin >> a;
            field[i][j] = a;
            field[i][m] += a;
            field[n][j] += a;
            field[n][m] += a;
        }
    }

    cin >> a >> b >> c;
    v.push_back(a); v.push_back(b); v.push_back(c);
    sort(v.begin(), v.end());

    //vertical split
    if (m >= 3) {
        for (int i = 1; i <= m-2; ++i)
        {
            for (int j = i+1; j <= m-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[n][k];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[n][k];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear();
            }
        }
    }
    if (n >= 3){
        for (int i = 1; i <= n-2; ++i)
        {
            for (int j = i+1; j <= n-1; ++j)
            {
                sumtoi = 0;
                sumtoj = 0;
                sumtok = 0;
                //to i
                for (int k = 0; k < i; ++k)
                {
                    sumtoi += field[k][m];
                }

                //from i to j
                for (int k = i; k < j; ++k)
                {
                    sumtoj += field[k][m];
                }

                sumtok = field[n][m] - sumtoi - sumtoj;
                vx.push_back(sumtoi); vx.push_back(sumtoj); vx.push_back(sumtok);
                sort(vx.begin(), vx.end());

                if(v[0] == vx[0] && v[1] == vx[1] && v[2] == vx[2])
                    cnt++;
                vx.clear();

            }
        }
    }

    printf("%d\n", cnt);
    return 0;
}


#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
//作者:中国江苏南京丁天行
using namespace std;
int n,m,a[60][60],r[60],c[60],p[5],ans;
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                    scanf("%d",&a[i][j]);
                    r[i]+=a[i][j];
                    c[j]+=a[i][j];
            }
    }
    for(int i=2;i<=n;i++)r[i]+=r[i-1];
    for(int i=2;i<=m;i++)c[i]+=c[i-1];
    scanf("%d%d%d",p+1,p+2,p+3);
    sort(p+1,p+4);
    if(p[1]+p[2]+p[3]!=r[n]){
                             printf("0\n");
                             return 0;
    }
    do{
          for(int r1=1;r1<=n-2;r1++){
                  for(int r2=r1+1;r2<=n-1;r2++){
                          if(r[r1]==p[1]&&r[r2]-r[r1]==p[2]) ans++;
                  }
          }
          for(int c1=1;c1<=m-2;c1++){
                  for(int c2=c1+1;c2<=m-1;c2++){
                          if(c[c1]==p[1]&&c[c2]-c[c1]==p[2]) ans++;
                  }
          }
    }while(next_permutation(p+1,p+4));
    printf("%d\n",ans);
   // system("pause");
    return 0;
}


#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
//作者:中国江苏南京丁天行
using namespace std;
int n,m,a[60][60],r[60],c[60],p[5],ans;
int main()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                    scanf("%d",&a[i][j]);
                    r[i]+=a[i][j];
                    c[j]+=a[i][j];
            }
    }
    scanf("%d%d%d",p+1,p+2,p+3);
    do{
          for(int r1=1;r1<=n-2;r1++){
                  for(int r2=r1+1;r2<=n-1;r2++){
                          int s1=0,s2=0;
                          for(int i=1;i<=r1;i++)s1+=r[i];
                          for(int i=r1+1;i<=r2;i++)s2+=r[i];
                          if(s1==p[1]&&s2==p[2]) ans++;
                  }
          }
          for(int c1=1;c1<=m-2;c1++){
                  for(int c2=c1+1;c2<=m-1;c2++){
                          int s1=0,s2=0;
                          for(int i=1;i<=c1;i++)s1+=c[i];
                          for(int i=c1+1;i<=c2;i++)s2+=c[i];
                          if(s1==p[1]&&s2==p[2]) ans++;
                  }
          }
    }while(next_permutation(p+1,p+4));
    printf("%d\n",ans);
	return 0;
}