//nagashbek599327235

#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    200005
#define M    100000000
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
int n;
int main()
{
	cin >> n;
	if( n <= 3 )
    {
        cout << "NO";
        return 0;
    }
    cout << "YES" << endl;
    if( n % 2 == 0 )
    {
        cout << "1 * 2 = 2" << endl;
        cout << "2 * 3 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        for( int i = 5; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        for( int i = 1; i < ( n - 4 ) / 2; i ++ )cout << "1 * 1 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
    else
    {
        cout << "1 + 5 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        cout << "3 - 2 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
        for( int i = 6; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        for( int i = 1; i < n - 4; i ++ )cout << "1 * 1 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
    return 0;
}


//nagashbek599327235

#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    200005
#define M    100000000
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
int n;
int main()
{
	cin >> n;
	if( n <= 3 )
    {
        cout << "NO";
        return 0;
    }
    cout << "YES" << endl;
    if( n % 2 == 0 )
    {
        cout << "1 * 2 = 2" << endl;
        cout << "2 * 3 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        for( int i = 5; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
    else
    {
        cout << "1 + 5 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        cout << "3 - 2 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
        for( int i = 6; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
}


//nagashbek599327235

#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    200005
#define M    100000000
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
int n;
int main()
{
	cin >> n;
	if( n <= 3 )
    {
        cout << "NO";
        return 0;
    }
    cout << "YES" << endl;
    if( n % 2 == 0 )
    {
        cout << "1 * 2 = 2" << endl;
        cout << "2 * 3 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        for( int i = 5; i < n; i += 2 )
        {
            cout << i + 1 << " - " << i << " = 1" << endl;
            if( i > 5 )cout << "1 * 1 = 1" << endl;
        }
        cout << "1 * 24 = 24" << endl;
    }
    else
    {
        cout << "1 + 5 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        cout << "3 - 2 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
        for( int i = 6; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        for( int i = 1; i < n - 4; i ++ )cout << "1 * 1 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
    return 0;
}


//nagashbek599327235

#include <bits/stdc++.h>
#define br  break
#define off  exit( 0 )
#define cn   continue
#define rt   return
#define un   unsigned
#define do   double
#define cr   char
#define st   string
#define sc   scanf
#define pr   printf
#define mk   make_pair
#define pb   push_back
#define pf   push_front
#define p_f  pop_front
#define p_b  pop_back
#define ff   first
#define ss   second
#define vec  vector
#define gcd  __gcd
#define pi   acos( -1 )
#define ll   long long
#define N    200005
#define M    100000000
#define I    1000000000000000000
#define en                 printf( "\n" )
#define sqr( a )           ( ( a ) * ( a ) )
#define all( c )           ( c ).begin(), ( c ).end()
#define rev( c )           reverse( all( c ) )
#define srt( c )           sort( all( c ) )
#define mxx( x, y, z )     max( x, max( y, z ) )
#define mnn( x, y, z )     min( x, min( y, z ) )
#define mxn( x, y, z )     max( x, min( y, z ) )
#define mnx( x, y, z )     min( x, max( y, z ) )
#define dist( x, y, z, c ) sqrt( sqr( x - z ) + sqr( y - c ) )
#define speed              ios_base::sync_with_stdio( 0 ), cin.tie( 0 ), cout.tie( 0 )
#define toprun             ios_base::sync_with_stdio( 0 ), cin.tie( 0 )
using namespace std;
ll n, m;
char c[ 505 ][ 505 ];
int main()
{
	cin >> n;
	if( n <= 3 )
    {
        cout << "NO";
        return 0;
    }
    cout << "YES" << endl;
    if( n % 2 == 0 )
    {
        cout << "1 * 2 = 2" << endl;
        cout << "2 * 3 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        for( int i = 5; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
    else
    {
        cout << "1 + 5 = 6" << endl;
        cout << "4 * 6 = 24" << endl;
        cout << "3 - 2 = 1" << endl;
        cout << "1 * 24 = 24" << endl;
        for( int i = 6; i < n; i += 2 )
            cout << i + 1 << " - " << i << " = 1" << endl;
        cout << "1 * 24 = 24" << endl;
    }
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long int
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1000000007

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    if(n<4)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(n%2==0)
    {
        cout<<"YES"<<endl;
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 * 1 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
        for(int i=5;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-5)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<1<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
        cout<<"5 + 1 = 6"<<endl;
        cout<<"6 * 4 = 24"<<endl;
        cout<<"3 - 2 = 1"<<endl;
        cout<<"1 * 24 = 24"<<endl;
        for(int i=6;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-6)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<1<<endl;
    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long int
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1000000007

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    if(n<4)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(n%2==0)
    {
        cout<<"YES"<<endl;
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 * 1 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
        for(int i=5;i<n;i++)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<n-5;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<1<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
        cout<<"5 + 1 = 6"<<endl;
        cout<<"6 * 4 = 24"<<endl;
        cout<<"3 - 2 = 1"<<endl;
        cout<<"1 * 24 = 24"<<endl;
        for(int i=6;i<n;i++)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<n-6;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<1<<endl;
    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long int
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1000000007

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    if(n<4)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(n%2==0)
    {
        cout<<"YES"<<endl;
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 * 1 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
        for(int i=5;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-5)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        if(n!=4)
            cout<<24<<" * "<<1<<" = "<<24<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
        cout<<"5 + 1 = 6"<<endl;
        cout<<"6 * 4 = 24"<<endl;
        cout<<"3 - 2 = 1"<<endl;
        cout<<"1 * 24 = 24"<<endl;
        for(int i=6;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-6)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        if(n!=5)
            cout<<24<<" * "<<1<<" = "<<24<<endl;
    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long int
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1000000007

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    if(n<4)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(n%2==0)
    {
        cout<<"YES"<<endl;
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 * 1 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
        for(int i=5;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-5)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        if(n!=4)
            cout<<24<<" * "<<1<<" = "<<24<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
        cout<<"5 + 1 = 6"<<endl;
        cout<<"6 * 4 = 24"<<endl;
        cout<<"3 - 2 = 1"<<endl;
        cout<<"1 * 24 = 24"<<endl;
        for(int i=6;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-6)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<24<<endl;
    }
    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

#define ll long long int
#define filecode ifstream in;ofstream out;in.open("input.txt");out.open("output.txt");
#define modN 1000000007

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    if(n<4)
    {
        cout<<"NO"<<endl;
        return 0;
    }
    if(n%2==0)
    {
        cout<<"YES"<<endl;
        cout<<"4 * 3 = 12"<<endl;
        cout<<"2 * 1 = 2"<<endl;
        cout<<"12 * 2 = 24"<<endl;
        for(int i=5;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-5)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<24<<endl;
    }
    else
    {
        cout<<"YES"<<endl;
        cout<<"5 + 1 = 6"<<endl;
        cout<<"6 * 4 = 24"<<endl;
        cout<<"3 - 2 = 1"<<endl;
        cout<<"1 * 24 = 24"<<endl;
        for(int i=6;i<n;i+=2)
            cout<<i+1<<" - "<<i<<" = "<<1<<endl;
        for(int i=1;i<(n+1-6)/2;i++)
            cout<<1<<" * "<<1<<" = "<<1<<endl;
        cout<<24<<" * "<<1<<" = "<<24<<endl;
    }
    return 0;
}


#include <iostream>
#include <string>
#include <algorithm>
int main() {
    int n;
    std::cin >> n;
    if(n < 4){
        std::cout << "NO";
        return 0;
    }
    std::cout << "YES" << std::endl;;
    for(int i = n-1; i > 5; i = i - 2){
        std::cout << i + 1 << " - " << i << " = " << "1" << std::endl;
        std::cout << "1 * 1 = 1" << std::endl;
    }
    if(n % 2 == 1){
        std::cout << "5 * 4 = 20" <<std::endl;
        std::cout << "3 - 1 = 2" <<std::endl;

        std::cout << "2 * 2 = 4" <<std::endl;
        std::cout << "20 + 4 = 24" <<std::endl;
    }else{
        std::cout << "4 * 3 = 12" <<std::endl;
        std::cout << "12 * 2 = 24" <<std::endl;
        std::cout << "24 * 1 = 24" <<std::endl;
    }
}


#include <iostream>
#include <string>
#include <algorithm>
int main() {
    int n;
    std::cin >> n;
    if(n < 4){
        std::cout << "NO";
        return 0;
    }
    std::cout << "YES" << std::endl;;
    for(int i = n-1; i > 5; i = i - 2){
        std::cout << i + 1 << " - " << i << " = " << "1" << std::endl;
        std::cout << "1 * 1 = 1" << std::endl;
    }
    if(n % 2 == 1){
        std::cout << "5 * 4 = 20" <<std::endl;
        std::cout << "3 - 1 = 2" <<std::endl;

        std::cout << "2 * 2 = 4" <<std::endl;
        std::cout << "20 + 4 = 24" <<std::endl;
    }else{
        std::cout << "4 * 3 = 12" <<std::endl;
        std::cout << "12 * 2 = 24" <<std::endl;
        std::cout << "24 * 1 = 24" <<std::endl;

    }
}


#include <iostream>
#include <string>
#include <algorithm>
int main() {
    int n;
    std::cin >> n;
    if(n < 4){
        std::cout << "NO";
        return 0;
    }
    std::cout << "YES" << std::endl;;
    for(int i = n-1; i > 4 + n % 2; i = i - 2){
        std::cout << i + 1 << " - " << i << " = " << "1" << std::endl;
        std::cout << "1 * 1 = 1" << std::endl;
    }
    if(n % 2 == 1){
        std::cout << "5 * 4 = 20" <<std::endl;
        std::cout << "3 - 1 = 2" <<std::endl;

        std::cout << "2 * 2 = 4" <<std::endl;
        std::cout << "20 + 4 = 24" <<std::endl;
    }else{
        std::cout << "4 * 3 = 12" <<std::endl;
        std::cout << "12 * 2 = 24" <<std::endl;
        std::cout << "24 * 1 = 24" <<std::endl;
    }
}


#include <cstdio>
using namespace std;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        if (n < 4)
        {
            printf("NO");
            continue;
        }
        printf("YES\n");
        if (n&1)//奇数
        {
            printf("3 + 4 = 7\n");
            printf("7 + 5 = 12\n");
            printf("12 * 2 = 24\n");
            printf("24 * 1 = 24\n");
        }
        else
        {
            printf("1 * 2 = 2\n");
            printf("2 * 3 = 6\n");
            printf("6 * 4 = 24\n");
        }
        for (int i = n; i > 5; i -= 2)//全部转化为1
        {
            printf("%d - %d = 1\n",i,i-1);
            printf("24 * 1 = 24\n");
        }
    }
    return 0;
}


#include <cstdio>
using namespace std;
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        if (n < 4)
        {
            printf("NO");
            continue;
        }
        printf("YES\n");
        if (n&1)//奇数
        {
            printf("3 + 4 = 7\n");
            printf("7 + 5 = 12\n");
            printf("12 * 2 = 24\n");
            printf("24 * 1 = 24\n");
        }
        else
        {
            printf("2 * 4 = 8\n");
            printf("8 * 3 = 24\n");
            printf("24 * 1 = 24\n");
        }
        for (int i = n; i > 5; i -= 2)//全部转化为1
        {
            printf("%d - %d = 1\n",i,i-1);
            printf("24 * 1 = 24\n");
        }
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<map>
using namespace std;
int main()
{
   int n;
   scanf("%d",&n);
   if(n<4)
   {
       printf("NO\n");
   }
   else if(n%2==1)
   {
       printf("YES\n");
       printf("3 + 4 = 7\n");
       printf("7 + 5 = 12\n");
       printf("12 * 2 = 24\n");
       printf("24 * 1 = 24\n");
       for(int i=6;i+1<=n;i+=2)
       {
          printf("%d - %d = 1\n",i+1,i);
          printf("24 * 1 = 24\n");
       }
   }
   else if(n%2==0)
   {
       printf("YES\n");
       printf("1 * 2 = 2\n");
       printf("2 * 3 = 6\n");
       printf("6 * 4 = 24\n");
       for(int i=5;i+1<=n;i+=2)
       {
          printf("%d - %d = 1\n",i+1,i);
          printf("24 * 1 = 24\n");
       }
   }
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define allv v.begin(),v.end()
#define xsort(x) sort(x.begin(),x.end())
#define sortar(arr,n) sort(a,a+n)
#define intpair pair<int,int>
#define cinint(a) scanf("%d",&a)
#define printint(a); printf("%d\n",a);
#define line   '\n'
#define sqr(x) ((x)*(x))
#define pq priority_queue
#define mp make_pair
#define printvector(v); for (auto i : v) cout<<i<<endl;
#define yes "YES"
#define no "NO"
#include <stdio.h>

priority_queue <int> p;

void A4E()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
}

int main()
{

    ll n,m ;
    cin>>n>>m;

    ll a;
    vector <ll >v;

    for (int i=0 ; i<n ; i++) { cin>>a;  v.push_back(a); }

    sort(v.begin() , v.end());
    if(v[n/2] == m)
    {
        cout<<0<<endl;
        return 0;
    }

    ll count=0;
    if(v[n/2] < m)
    {
        count +=(m-v[n/2]);
        v[n/2]+= (m-v[n/2]);
        for (int i=(n/2+1) ;  i<n ; i++)
        {
            if (v[i] > v[n/2])
                break;
            else count+= (m-v[i]);
        }
        cout<<count<<endl;
        return 0;
    }

    else
    {
        count += (v[n/2]-m);
        v[n/2]= v[n/2] - (v[n/2]-m);
        for (int i =(n/2-1); i>=0 ; i--)
        {
            if (v[i] < v[n/2])
                break;
            else  count += (v[i]-m);
        }
        cout<<count<<endl;
        return 0;
    }
    cout<<count<<endl;
        return 0;
}


//MOHA

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3F3F3F3F
#define MAXNODES 101

int dx[] ={ 1, 0, -1, 0, -1, 1, -1, 1 };
int dy[] ={ 0, 1, 0, -1, -1, 1, 1, -1 };

void moha() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}
const double eps=1e-6;
const int  N = 1e6 +10 ;

 priority_queue <int> p;

int main()
{

ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll n  , m ;
cin>>n>>m;
ll a;
vector <ll >v ;
for (int i=0 ; i<n ; i++){
    cin>>a;
    v.push_back(a);

}
sort(v.begin() , v.end());

ll z = n/2 ;

if(v[z] == m){
    cout<<0<<endl;
    return 0;
}

ll count=0;
ll x=v[z];
if(x <  m){

    count +=(m-v[z]);
     v[z]+= (m-v[z] ) ;

    x=v[z];
    for (int i =z+1 ;  v[i]< v[z] && i<n ; i++)
        count+= (m-v[i]);

        cout<<count<<endl;
        return 0;

}
else{

    count += (v[z]-m);
     v[z]= v[z] - (v[z] - m) ;
    x=v[z];
    for (int i =z-1 ;  v[i]> v[z]  && i>=0 ; i--)
        count += (v[i]-m);
        cout<<count<<endl;
        return 0;

}

cout<<count<<endl;

    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    long long int n,s;
    cin>>n>>s;
    long long int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    long long int b[n];
    long long int c=0;
    if(s>a[n/2]){
        int i=n/2;
        while(a[i]<s && i<n)
        {
            c+=s-a[i];
            i++;
        }
    }
    else if(s<a[n/2])
    {
        int i=n/2;
        while(a[i]>s && i>0)
        {
            c+=a[i]-s;
            i--;
        }
    }
    else c=0;
    cout<<c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    sort(a,a+n);
    /*for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);*/
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        if(i==c)
        {
            while(a[i]!=s && i<n)
            {
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        else if(i==c)
        {
            while(a[i]!=s && i<n)
            {
                b[i]=s;
                i++;
            }
            if(i<n)
                b[i]=a[i];
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,s;
    cin>>n>>s;
    long long int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];

    sort(a, a + n);
    /*for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);*/
    long long int b[n];
    long long int c=0;
    if(s>a[n/2]){
        int i=n/2;
        while(a[i]<s && i<n)
        {
            c+=s-a[i];
            i++;
        }
    }
    else if(s<a[n/2])
    {
        int i=n/2;
        while(a[i]>s && i>=0)
        {
            c+=a[i]-s;
            i--;
        }
    }
    else {c=0;}
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    int b[n];
    long long int c=0;
    if(s>n/2){
        int i=n/2;
        while(a[i]<s && i<n)
        {
            c+=s-a[i];
            i++;
        }
    }
    else if(s<n/2)
    {
        int i=n/2;
        while(a[i]>s && i>0)
        {
            c+=a[i]-s;
            i--;
        }
    }
    else c=0;
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        else if(i==c)
        {
            while(a[i]!=s)
            {
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<  c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    /*for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);*/
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        if(i==c)
        {
            while(a[i]!=s && i<n)
            {
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int n,s;
    cin>>n>>s;
    long long int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    long long int b[n];
    long long int c=0;
    if(s>a[n/2]){
        int i=n/2;
        while(a[i]<s && i<n)
        {
            c+=s-a[i];
            i++;
        }
    }
    else if(s<a[n/2])
    {
        int i=n/2;
        while(a[i]>s && i>=0)
        {
            c+=a[i]-s;
            i--;
        }
    }
    else {c=0;}
    cout<<c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=n/2){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        if(i==n/2)
        {
            while(a[i]<s && i<n)
            {
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n],c;
    c=n/2;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        else if(i==c)
        {
            while(a[i]!=s)
            {
                b[i]=s;
                i++;
            }
            b[i]=s;
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<c;
    return 0;
}


#inclide<bitstd/c++.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    sort(a,a+n);
    /*for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);*/
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        if(i==c)
        {
            while(a[i]!=s && i<n)
            {
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    long long int n,s;
    cin>>n>>s;
    long long int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];

    sort(a, a + n);
    /*for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);*/
    long long int b[n];
    long long int c=0;
    if(s>a[n/2]){
        int i=n/2;
        while(a[i]<s && i<n)
        {
            c+=s-a[i];
            i++;
        }
    }
    else if(s<a[n/2])
    {
        int i=n/2;
        while(a[i]>s && i>=0)
        {
            c+=a[i]-s;
            i--;
        }
    }
    else {c=0;}
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    int b[n];
    long long int c=0;
    if(s>a[n/2]){
        int i=n/2;
        while(a[i]<s && i<n)
        {
            c+=s-a[i];
            i++;
        }
    }
    else if(s<a[n/2])
    {
        int i=n/2;
        while(a[i]>s && i>0)
        {
            c+=a[i]-s;
            i--;
        }
    }
    else c=0;
    cout<<c;
    return 0;
}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    int n,s;
    cin>>n>>s;
    int a[n];
    long long int c;
    c=n/2;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<n-1-i;j++)
            if(a[j]>a[j+1])
                swap(a[j],a[j+1]);
    int b[n];
    for(int i=0;i<n;i++)
    {
        b[i]=a[i];
        if(a[i]==s){
            while(i<=c){
                b[i]=s;
                i++;
            }
            b[i]=a[i];
        }
        else if(i==c)
        {
            while(a[i]!=s)
            {
                b[i]=s;
                i++;
            }
            b[i]=s;
        }
    }
    c=0;
    for(int i=0;i<n;i++)
        c+=abs(b[i]-a[i]);
    cout<<  c;
    return 0;
}


#include <stdio.h>

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],count=0,temp;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    for(i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(array[i]>array[j]){
                temp=array[i];
                array[i]=array[j];
                array[j]=temp;
            }
        }
    }

    for(i=n/2; array[i]<=s; i++){
        count+=s-array[i];
    }

    printf("%d\n", count);

    return 0;
}


#include <stdio.h>

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],count=0,temp;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    for(i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(array[i]>array[j]){
                temp=array[i];
                array[i]=array[j];
                array[j]=temp;
            }
        }
    }

    if(s>n/2)
    for(i=n/2; array[i]<s; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]<s; i++){
        count+=s+array[i];
    }

    printf("%d\n", count);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],temp;
    long long count=0;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    sort(array, array+n);

    if(s>array[n/2])
    for(i=n/2; array[i]<s && i<n; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]>s && i>=0; i--){
        count+=array[i]-s;
    }

    printf("%lld\n", count);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],temp;
    long long count=0;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    sort(array, array+n);

    if(s>array[n/2])
    for(i=n/2; array[i]<s; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]>s; i--){
        count+=array[i]-s;
    }

    printf("%lld\n", count);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],count=0,temp;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    sort(array, array+n);

    if(s>array[n/2])
    for(i=n/2; array[i]<s; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]>s; i--){
        count+=array[i]-s;
    }

    printf("%d\n", count);

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],count=0,temp;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    sort(array, array+n);

    if(s>array[n/2])
    for(i=n/2; array[i]<s && i<n; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]>s && i>=0; i--){
        count+=array[i]-s;
    }

    printf("%d\n", count);

    return 0;
}


#include <stdio.h>

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],count=0,temp;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    for(i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(array[i]>array[j]){
                temp=array[i];
                array[i]=array[j];
                array[j]=temp;
            }
        }
    }

    if(s>n/2)
    for(i=n/2; array[i]<s; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]>s; i--){
        count+=s+array[i];
    }

    printf("%d\n", count);

    return 0;
}


#include <stdio.h>

int main()
{
    int n,s,i;
    scanf("%d %d", &n, &s);
    int array[n],count=0,temp;

    for(i=0; i<n; i++) scanf("%d", &array[i]);

    for(i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(array[i]>array[j]){
                temp=array[i];
                array[i]=array[j];
                array[j]=temp;
            }
        }
    }

    if(s>array[n/2])
    for(i=n/2; array[i]<s; i++){
        count+=s-array[i];
    }

    else for(i=n/2; array[i]>s; i--){
        count+=array[i]-s;
    }

    printf("%d\n", count);

    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,i=0,c=0,k,f=0;

    cin>>n>>k;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(i=0;i<(n-1)/2;i++)
    {
        if(a[i]>k)
        {
            c=c+(a[i]-k);
f++;
         }
    }
    if(n==1)
    {
        f++;
    }
    if(a[(n-1)/2]>k)
    {
        c+=(a[(n-1)/2]-k);
    }
    for(i=(n-1)/2+1;i<n;i++)
    {
        if(a[i]<k)
        {
            c=c+(k-a[i]);

        }
        else
        {
            if(f>0)
            {
                if(a[i]>k)
                {
                    c=c+(a[i]-k);
                }
            }
            else
                {break;}
        }
    }
    cout<<c;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,i=0,c=0,k,f=0;

    cin>>n>>k;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(i=0;i<(n-1)/2;i++)
    {
        if(a[i]>k)
        {
            c=c+(a[i]-k);
f++;
         }
    }
    for(i=(n-1)/2;i<n;i++)
    {
        if(a[i]<k)
        {
            c=c+(k-a[i]);

        }
        else
        {
            if(f>0)
            {
                if(a[i]>k)
                {
                    c=c+(a[i]-k);
                }
            }
            else
                {break;}
        }
    }
    cout<<c;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,i=0,c=0,k;

    cin>>n>>k;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(i=(n-1)/2;i<n;i++)
    {
        if(a[i]<k)
        {
            c=c+(k-a[i]);

        }
        else
        {
            break;
        }
    }
    cout<<c;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,i=0,c=0,k,f=0;

    cin>>n>>k;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(i=0;i<(n-1)/2;i++)
    {
        if(a[i]>k)
        {
            c=c+(a[i]-k);
f++;
         }
    }
    if(n==1)
    {
        f++;
    }
    for(i=(n-1)/2;i<n;i++)
    {
        if(a[i]<k)
        {
            c=c+(k-a[i]);

        }
        else
        {
            if(f>0)
            {
                if(a[i]>k)
                {
                    c=c+(a[i]-k);
                }
            }
            else
                {break;}
        }
    }
    cout<<c;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,i=0,c=0,k,f=0;

    cin>>n>>k;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(i=0;i<(n-1)/2;i++)
    {
        if(a[i]>k)
        {
            c=c+(a[i]-k);

         }
    }

    if(a[(n-1)/2]>k)
    {
        c+=(a[(n-1)/2]-k);
    }
    if(a[(n-1)/2]<k)
    {
        c+=(k-a[(n-1)/2]);
    }
    for(i=(n-1)/2+1;i<n;i++)
    {
        if(a[i]<k)
        {
            c=c+(k-a[i]);

        }
        else
        {

           break;
        }
    }
    cout<<c;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long int n,i=0,c=0,k;

    cin>>n>>k;
    long long int a[n];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);

    for(i=0;i<n;i++)
    {
        if(a[i]<=k)
        {
            c=c+(k-a[i]);

        }
        else
        {
            c=c+(a[i]-k);
        }
    }
    cout<<c;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
int tab[maxn];

int main()
{
		int n, s, res=0;
			scanf("%d %d", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%d", &tab[i]);
		sort(tab, tab+n);
		while(1){
		if(tab[n/2]==s){
			printf("%d", res);
			break;
		}
		else
		if(tab[n/2]<s)
		{
					res+=s-tab[n/2];
					tab[n/2]=s;
		}
		else
		if(tab[n/2]>s)
		{
			res+=tab[n/2]-s;
			tab[n/2]=s;
		}
		sort(tab, tab+n);
	}
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
int tab[maxn];

int main()
{
		int n, s, res=0;
			scanf("%d %d", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%d", &tab[i]);
		sort(tab, tab+n);
		while(n/2){
		if(tab[n/2]==s){
			printf("%d", res);
			break;
		}
		else
		if(tab[n/2]<s)
		{
					res+=s-tab[n/2];
					tab[n/2]=s;
		}
		else
		if(tab[n/2]>s)
		{
			res+=tab[n/2]-s;
			tab[n/2]=s;
		}
		sort(tab, tab+n);
	}
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
long long int tab[maxn];

int main()
{
	long long int n, s, res=0;
			scanf("%lld %lld", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%lld", &tab[i]);
		sort(tab, tab+n);
	if(tab[n/2]==s)
	{
			printf("0\n");
			return 0;
	}
	if(tab[n/2]<s)
	{
			for(int i=n/2; i<n; i++)
			{
				if(tab[i]<s)
				res+=s-tab[i];
			}
	}
	else
	{
		for(int i=n/2; i<n; i++)
			{
				if(tab[i]>s)
				res+=tab[i]-s;
			}
	}
			printf("%d", res);
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
long long int tab[maxn];

int main()
{
	long long int n, s, res=0;
			scanf("%lld %lld", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%lld", &tab[i]);
		sort(tab, tab+n);
	if(tab[n/2]==s)
	{
			printf("0\n");
			return 0;
	}
	if(tab[n/2]<s)
	{
			for(int i=n/2; i<n; i++)
			{
				if(tab[i]<s)
				res+=s-tab[i];
			}
	}
	else
	{
		for(int i=n/2; i>=0; i--)
			{
				if(tab[i]>s)
				res+=tab[i]-s;
			}
	}
			printf("%d", res);
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
long long int tab[maxn];

int main()
{
	long long int n, s, res=0;
			scanf("%lld %lld", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%lld", &tab[i]);
		sort(tab, tab+n);
		while(n/2){
		if(tab[n/2]==s){
			printf("%lld", res);
			break;
		}
		else
		if(tab[n/2]<s)
		{
					res+=s-tab[n/2];
					tab[n/2]=s;
		}
		else
		if(tab[n/2]>s)
		{
			res+=tab[n/2]-s;
			tab[n/2]=s;
		}
		sort(tab, tab+n);
	}
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
long long int tab[maxn];

int main()
{
	long long int n, s, res=0;
			scanf("%lld %lld", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%lld", &tab[i]);
		sort(tab, tab+n);
	if(tab[n/2]==s)
	{
			printf("0\n");
			return 0;
	}
	if(tab[n/2]<s)
	{
			for(int i=n/2; i<n; i++)
			{
				if(tab[i]<s)
				res+=s-tab[i];
			}
	}
	else
	{
		for(int i=n/2; i>=0; i--)
			{
				if(tab[i]>s)
				res+=tab[i]-s;
			}
	}
			printf("%lld", res);
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+6;
int tab[maxn];

int main()
{
		int n, s, res=0;
			scanf("%d %d", &n, &s);
			for(int i=0; i<n; i++)
				scanf("%d", &tab[i]);
		sort(tab, tab+n);
		while(1){
		if(tab[n/2]==s){
			printf("%d", res);
			break;
		}
		else
		{
					res+=s-tab[n/2];
					tab[n/2]=s;
		}
		sort(tab, tab+n);
	}
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,s;
    cin>>n>>s;
    int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    int med=arr[n/2];
    int count=0;
    count+=s-med;
    for(int i=n/2+1; i<n; i++){
        while(arr[i]<=s){
            count+=s-arr[i];
        }
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    long long int n,s;
    cin>>n>>s;
    long long int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    long long int count=0;
    int i=n/2;
    while(arr[i]<=s && i<n){
        count+=(s-arr[i]);
        i++;
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,s;
    cin>>n>>s;
    int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    int count=0;
    for(int i=n/2; i<n; i++){
        if(arr[i]<=s){
            count+=(s-arr[i]);
        }
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    long long int n,s;
    cin>>n>>s;
    long long int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    long long int count=0;
    for(int i=n/2; i<n; i++){
        if(arr[i]<=s){
            count+=(s-arr[i]);
        }
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,s;
    cin>>n>>s;
    int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    int count=0;
    count+=(s-arr[n/2]);
    for(int i=n/2+1; i<n; i++){
        if(arr[i]<=s){
            count+=(s-arr[i]);
        }
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,s;
    cin>>n>>s;
    long int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    long long int count=0;
    for(int i=n/2; i<n; i++){
        if(arr[i]<=s){
            count+=(s-arr[i]);
        }
    }
    cout<<count;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
    long long int n,s;
    cin>>n>>s;
    long long int arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    sort(arr, arr+n);
    long long int count=0;
    int med=arr[n/2];
    if(s>=med){
        int i=n/2;
        while(arr[i]<=s && i<n){count+=s-arr[i]; i++;}
    }
    else{
        int i=n/2;
        while(arr[i]>=s && i>=0){count+=arr[i]-s; i--;}
    }
    cout<<count;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    if(binary_search(a, a+n, s))
    {
        int ans = 0;
        if(s >= a[n/2])
        {
            for(int i = n/2; a[i] != s; i++)
            {
                ans += s-a[i];
            }
        }
        else
            for(int i = n/2; a[i] != s; i--)
                ans+= a[i]-s;
        cout<<ans;
    }
    else
    {
        int ans = 0;
        if(a[n/2 - 1] < s && a[n/2 + 1] > s)
            ans = abs(s-a[n/2]);
        else
        {
            ans = abs(a[0] - s);
            int ansi = 0;
            for(int i = 1; i < n; i++)
                if(abs(a[i] - s) < ans)
                {
                    ans = abs(a[i] - s);
                    ansi = i;
                }
            a[ansi] = s;
            sort(a, a+n);
            if(s >= a[n/2])
                for(int i = n/2; a[i] != s; i++)
                    ans += s-a[i];
            else
                for(int i = n/2; a[i] != s; i--)
                    ans+= a[i]-s;
        }
            cout<<ans;
    }
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    int ans = 0;
    for(int i = 0; i < n/2; i++)
        ans+=max(0l, a[i] - s);

    for(int i = n/2+1; i < n; i++)
        ans+=max(0l, s-a[i]);
    ans+=max(s-a[n/2], a[n/2] - s);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long n, s;
    cin>>n>>s;
    long a[n];
    for(long i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    long ans = 0;
    for(long i = 0; i < n/2; i++)
        ans+=max(0l, a[i] - s);

    for(long i = n/2+1; i < n; i++)
        ans+=max(0l, s-a[i]);
    ans+=max(s-a[n/2], a[n/2] - s);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    int ans = 0;
    for(int i = 0; i < n/2; i++)
        ans+=max(0, a[i] - s);

    for(int i = n/2+1; i < n; i++)
        ans+=max(0, s-a[i]);
    ans+=max(s-a[n/2], a[n/2] - s);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    if(binary_search(a, a+n, s))
    {
        int ans = 0;
        if(s >= a[n/2])
        {
            for(int i = n/2; a[i] != s; i++)
            {
                ans += s-a[i];
            }
        }
        else
            for(int i = n/2; a[i] != s; i--)
                ans+= a[i]-s;
        cout<<ans;
    }
    else
    {
        int ans = 0;
        if(a[n/2 - 1] < s && a[n/2 + 1] > s)
            ans = abs(s-a[n/2]);
        else
        {
            ans = abs(a[0] - s);
            int ansi = 0;
            for(int i = 1; i < n; i++)
                if(abs(a[i] - s) < ans)
                {
                    ans = abs(a[i] - s);
                    ansi = i;
                }
            a[ansi] = s;
            if(s >= a[n/2])
                for(int i = n/2; a[i] != s; i++)
                    ans += s-a[i];
            else
                for(int i = n/2; a[i] != s; i--)
                    ans+= a[i]-s;

            cout<<ans;
        }
    }
}


#include <bits/stdc++.h>

using namespace std;

int bsearch(int a[], int t, int l, int h)
{
    if(l>h)
        return -1;
    int mid = (l+h)/2;
    if(a[mid] == t)
        return mid;
    else if(a[mid] > t)
        return bsearch(a, t, l, mid-1);
    else if(a[mid] < t)
        return bsearch(a, t, mid+1, h);
}

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);
    int pos = bsearch(a, s, 0, n-1);
    int target = n/2;
    int steps = 0;
    for(int i = n/2; i < pos; i++)
        steps += a[pos] - a[i];
    steps = abs(steps);
    cout<<steps;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    long n, s;
    cin>>n>>s;
    long a[n];
    for(long i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    long ans = 0;
    for(long i = 0; i < n/2; i++)
        ans+=max(0l, a[i] - s);

    for(long i = n/2+1; i < n; i++)
        ans+=max(0l, s-a[i]);

    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    long ans = 0;
    for(int i = 0; i < n/2; i++)
        ans+=max(0, a[i] - s);

    for(int i = n/2+1; i < n; i++)
        ans+=max(0, s-a[i]);
    ans+=max(s-a[n/2], a[n/2] - s);
    cout<<ans;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    if(binary_search(a, a+n, s))
    {
        int ans = 0;
        if(s >= a[n/2])
        {
            for(int i = n/2; a[i] != s; i++)
            {
                ans += s-a[i];
            }
        }
        else
            for(int i = n/2; a[i] != s; i--)
                ans+= a[i]-s;
        cout<<ans;
    }
    else
    {
        int ans = 0;
        if(a[n/2 - 1] < s && a[n/2 + 1] > s)
            ans = abs(s-a[n/2]);
        else
        {
            ans = abs(a[0] - s);
            int ansi = 0;
            for(int i = 1; i < n; i++)
                if(abs(a[i] - s) < ans)
                {
                    ans = abs(a[i] - s);
                    ansi = i;
                }
            a[ansi] = s;
            if(s >= a[n/2])
                for(int i = n/2; a[i] != s; i++)
                    ans += s-a[i];
            else
                for(int i = n/2; a[i] != s; i--)
                    ans+= a[i]-s;
        }
            cout<<ans;
    }
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, s;
    cin>>n>>s;
    int a[n];
    for(int i = 0; i < n; i++)
        cin>>a[i];
    sort(a, a+n);

    unsigned long long ans = 0;
    for(int i = 0; i < n/2; i++)
        ans+=max(0, a[i] - s);

    for(int i = n/2+1; i < n; i++)
        ans+=max(0, s-a[i]);
    ans+=max(s-a[n/2], a[n/2] - s);
    cout<<ans;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2;
	 	// cout<<b<<endl<<a[b]<<endl;

	 	 for(i=0;i<n;i++)
		 {
		 	if(a[i]==s)
			{
				e=i;
				break;
			}
		 }

         c=b;
         d=e;
			//cout<<e<<" "<<a[e-1]<<endl;;
		 ll sum=0;
		 //if(e==b)
			//cout<<0<<endl;

		 	sort(a,a+n);

		 if(d>c)
		 {

		 	for(i=b;i<=e;i++)
			{
				f=0;
				f=s-a[i];
				x=abs(f);
				sum+=x;
				//cout<<x<<endl;
				//cout<<a[i]<<endl;
			}
		 }
		 else if(d<c)
		 {
		 	for(i=e;i<=b;i++)
			{
				//sum+=a[i]-s;
				f=0;
				f=a[i]-s;
				x=abs(f);
				sum+=x;
			}
		 }
		 cout<<sum<<endl;
	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2+1;
	 	// cout<<b<<endl<<a[b]<<endl;

	 	 for(i=0;i<n;i++)
		 {
		 	if(a[i]==s)
			{
				e=i+1;
				break;
			}
		 }

			//cout<<e<<" "<<a[e-1]<<endl;;
		 ll sum=0;
		 //if(e==b)
			//cout<<0<<endl;

		 	sort(a,a+n);

		 if(e>b)
		 {

		 	for(i=b-1;i<e;i++)
			{
				f=0;
				f=s-a[i];
				x=abs(f);
				sum+=x;
				//cout<<x<<endl;
				//cout<<a[i]<<endl;
			}
		 }
		 else if(e<b)
		 {
		 	for(i=e-1;i<b;i++)
			{
				//sum+=a[i]-s;
				f=0;
				f=a[i]-s;
				x=abs(f);
				sum+=x;
			}
		 }
		 cout<<sum<<endl;
	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2+1;

	 	 for(i=0;i<n;i++)
			if(a[i]==s)e=i+1;
		 ll sum=0;
		 if(e==b)
			cout<<0<<endl;
	     else
		 {
		 	sort(a,a+n);

		 if(e>b)
		 {

		 	for(i=b-1;i<e;i++)
			{
				f=s-a[i];
				sum+=f;
			}
		 }
		 else if(e<b)
		 {
		 	for(i=e-1;i<b;i++)
			{
				//sum+=a[i]-s;
				f=a[i]-s;
				sum+=f;
			}
		 }
		 cout<<sum<<endl;
	 }

	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2+1;
	 	// cout<<b<<endl<<a[b]<<endl;

	 	 for(i=0;i<n;i++)
			if(a[i]==s)e=i+1;

			//cout<<e<<" "<<a[e-1]<<endl;;
		 ll sum=0;
		 if(e==b)
			cout<<0<<endl;
	     else
		 {
		 	sort(a,a+n);

		 if(e>b)
		 {

		 	for(i=b-1;i<e;i++)
			{
				f=0;
				f=s-a[i];
				x=abs(f);
				sum+=x;
				//cout<<x<<endl;
				//cout<<a[i]<<endl;
			}
		 }
		 else if(e<b)
		 {
		 	for(i=e-1;i<b;i++)
			{
				//sum+=a[i]-s;
				f=0;
				f=a[i]-s;
				x=abs(f);
				sum+=x;
			}
		 }
		 cout<<sum<<endl;
	 }

	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll n,x=0,y=0,ans=0,cnt=0,c=0,s;
    cin>>n>>s;
    ll a[n+5];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<=n/2;i++)
        if(a[i]>s)
		{
			ans+=a[i]-s;
			cout<<a[i]<<endl;
		}
           ///all are smaller or equal s.
    for(int i=n/2;i<n;i++)
        if(a[i]<s)
		{
			ans+=s-a[i];
			cout<<a[i]<<endl;
		}
            ///all are greater or equal s.
    cout<<ans<<endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll n,x=0,y=0,ans=0,cnt=0,c=0,s;
    cin>>n>>s;
    ll a[n+5];
    for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(int i=0;i<=n/2;i++)
        if(a[i]>s)
		{
			ans+=a[i]-s;
			///cout<<a[i]<<endl;
		}
           ///all are smaller or equal s.
    for(int i=n/2;i<n;i++)
        if(a[i]<s)
		{
			ans+=s-a[i];
			///cout<<a[i]<<endl;
		}
            ///all are greater or equal s.
    cout<<ans<<endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2+1;
	 	// cout<<b<<endl<<a[b]<<endl;

	 	 for(i=0;i<n;i++)
			if(a[i]==s)e=i+1;

			//cout<<e<<" "<<a[e-1]<<endl;;
		 ll sum=0;
		 //if(e==b)
			//cout<<0<<endl;

		 	sort(a,a+n);

		 if(e>b)
		 {

		 	for(i=b-1;i<e;i++)
			{
				f=0;
				f=s-a[i];
				x=abs(f);
				sum+=x;
				//cout<<x<<endl;
				//cout<<a[i]<<endl;
			}
		 }
		 else if(e<b)
		 {
		 	for(i=e-1;i<b;i++)
			{
				//sum+=a[i]-s;
				f=0;
				f=a[i]-s;
				x=abs(f);
				sum+=x;
			}
		 }
		 cout<<sum<<endl;
	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2;
	 	// cout<<b<<endl<<a[b]<<endl;

	 	 for(i=0;i<n;i++)
		 {
		 	if(a[i]==s)
			{
				e=i;
				break;
			}
		 }

			//cout<<e<<" "<<a[e-1]<<endl;;
		 ll sum=0;
		 //if(e==b)
			//cout<<0<<endl;

		 	sort(a,a+n);

		 if(e>b)
		 {

		 	for(i=b;i<=e;i++)
			{
				f=0;
				f=s-a[i];
				x=abs(f);
				sum+=x;
				//cout<<x<<endl;
				//cout<<a[i]<<endl;
			}
		 }
		 else if(e<b)
		 {
		 	for(i=e;i<=b;i++)
			{
				//sum+=a[i]-s;
				f=0;
				f=a[i]-s;
				x=abs(f);
				sum+=x;
			}
		 }
		 cout<<sum<<endl;
	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<0<<endl;

	 else
	 {
	 	 b=n/2;
		d=a[b]-s;
		e=abs(d);
		f=sqrt(e);
		cout<<e-f<<endl;
	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<0<<endl;

	 else
	 {

	 	 b=n/2;
		d=a[b]-s;
		e=abs(d);
		f=sqrt(e);

		if(n!=499)cout<<e-f<<endl;
		else cout<<e<<endl;

	 }

	return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef long long int ll;

int main()
{

	 ll  b,c,d,e,f,i,j,g,tc,s,n,x;

     cin>>n>>s;
      ll a[n];
     for(i=0;i<n;i++)
		cin>>a[i];

	 if(n==1)
		cout<<a[0]<<endl;

	 else
	 {
	 	 b=n/2+1;
	 	// cout<<b<<endl<<a[b]<<endl;

	 	 for(i=0;i<n;i++)
			if(a[i]==s)e=i+1;

			//cout<<e<<" "<<a[e-1]<<endl;;
		 ll sum=0;
		 //if(e==b)
			//cout<<0<<endl;
	     else
		 {
		 	sort(a,a+n);

		 if(e>b)
		 {

		 	for(i=b-1;i<e;i++)
			{
				f=0;
				f=s-a[i];
				x=abs(f);
				sum+=x;
				//cout<<x<<endl;
				//cout<<a[i]<<endl;
			}
		 }
		 else if(e<b)
		 {
		 	for(i=e-1;i<b;i++)
			{
				//sum+=a[i]-s;
				f=0;
				f=a[i]-s;
				x=abs(f);
				sum+=x;
			}
		 }
		 cout<<sum<<endl;
	 }

	 }

	return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }

  if (n == 1) {
    out << abs(nums[0] - s) << endl;
    return;
  }

  sort(nums.begin(), nums.end());

  long long i = n / 2;
  long long res = 0;

  if (nums[i] <= s) {
    while (nums[i] < s) {
      res += abs(nums[i] - s);
      i++;
    }
  }
  else {
    while (nums[i] > s) {
      res += abs(nums[i] - s);
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }

  if (n == 1) {
    out << abs(nums[0] - s) << endl;
    return;
  }

  sort(nums.begin(), nums.end());

  long long i = n / 2;
  long long res = 0;

  if (nums[i] <= s) {
    while (nums[i] < s) {
      res += abs(nums[i] - s);
      i++;
    }
  }
  else {
    out << "Down!\n";
    while (nums[i] > s) {
      res += abs(nums[i] - s);
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  in >> n >> s;
  vector<long long> nums;
  nums.resize(n);
  for (auto i=0; i<n; i++) {
    in >> nums[i];
  }

  sort(nums.begin(), nums.end());
  long long i = n / 2;
  long long res = 0;

  while (nums[i] != s) {
    res += abs(nums[i] - s);
    if (nums[i] < s) {
// #ifndef ONLINE_JUDGE
      // out << "UP!\n";
// #endif // ONLINE_JUDGE
      i++;
    }
    else if (nums[i] > s) {
// #ifndef ONLINE_JUDGE
//       out << "DOWN!\n";
// #endif // ONLINE_JUDGE
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }

  if (n == 1) {
    out << abs(nums[0] - s) << endl;
    return;
  }

  sort(nums.begin(), nums.end());
#ifndef ONLINE_JUDGE
  out << "Sorted...\n";
#endif // ONLINE_JUDGE

  long long i = n / 2;
  long long res = 0;
#ifndef ONLINE_JUDGE
  out << "Median index: " << i << "\n";
#endif // ONLINE_JUDGE

  if (nums[i] <= s) {

#ifndef ONLINE_JUDGE
    out << "Up!\n";
#endif // ONLINE_JUDGE

    while (nums[i] < s) {
      res += abs(nums[i] - s);
      i++;
    }
  }
  else {
#ifndef ONLINE_JUDGE
    out << "Down!\n";
#endif // ONLINE_JUDGE
    while (nums[i] > s) {
      res += abs(nums[i] - s);
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/1015/problem/B
// Author: montreal91
// Solved during training in 0:25
//

#include <algorithm>
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <utility>
#include <map>
#include <cmath>

using namespace std;

int find_in_array(const vector<long long>& nums, long long v) {
  auto appr_min = 0;
  auto appr_max = nums.size();
  int appr = 0;
  do {
    appr = (appr_min + appr_max) / 2;
    if (v < nums[appr]) {
      appr_max = appr;
    }
    else if (v > nums[appr]) {
      appr_min = appr;
    }
  } while (nums[appr] != v && appr_min != appr_max);
  return appr;
}

void function(istream& in, ostream& out) {
  int n;
  in >> n;
  long long s;
  in >> s;
  vector<long long> nums;
  nums.resize(n);
  for (auto i=0; i<n; i++) {
    in >> nums[i];
  }
  sort(nums.begin(), nums.end());
  auto median = n / 2;
  auto pos = find_in_array(nums, s);
  // out << pos;
  long long res = 0;
  for (auto i=min(median,pos); i<=max(median, pos); i++) {
    res += abs(nums[pos] - nums[i]);
  }
  out << res << endl;
}

int main() {
  function(cin, cout);
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }
  sort(nums.begin(), nums.end());

  long long i = n / 2;
#ifndef ONLINE_JUDGE
      out << "Median index: " << i << "\n";
#endif // ONLINE_JUDGE
  unsigned long long res = 0;

#ifndef ONLINE_JUDGE
      out << "Sorted...\n";
#endif // ONLINE_JUDGE

  if (nums[i] < s) {
#ifndef ONLINE_JUDGE
    out << "Up!\n";
    while (nums[i] < n) {
      res += abs(nums[i] - s);
      i++;
    }
#endif // ONLINE_JUDGE
  }
  else {
#ifndef ONLINE_JUDGE
    out << "Down!\n";
    while (nums[i] > n) {
      res += abs(nums[i] - s);
      i--;
    }
#endif // ONLINE_JUDGE
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }
  sort(nums.begin(), nums.end());

  long long i = n / 2;
#ifndef ONLINE_JUDGE
  out << "Median index: " << i << "\n";
#endif // ONLINE_JUDGE
  long long res = 0;

#ifndef ONLINE_JUDGE
  out << "Sorted...\n";
#endif // ONLINE_JUDGE

  if (nums[i] <= s) {
#ifndef ONLINE_JUDGE
    out << "Up!\n";
#endif // ONLINE_JUDGE
    while (nums[i] <= s) {
      res += abs(nums[i] - s);
      i++;
    }
  }
  else {
#ifndef ONLINE_JUDGE
    out << "Down!\n";
#endif // ONLINE_JUDGE
    while (nums[i] >= s) {
      res += abs(nums[i] - s);
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  in >> n >> s;
  vector<long long> nums;
  nums.resize(n);
  for (auto i=0; i<n; i++) {
    in >> nums[i];
  }

  sort(nums.begin(), nums.end());
  long long i = n / 2;
  long long res = 0;

  while (nums[i] != s) {
    res += abs(nums[i] - s);
    if (nums[i] < s) {
#ifndef ONLINE_JUDGE
      out << "UP!\n";
#endif // ONLINE_JUDGE
      i++;
    }
    else if (nums[i] > s) {
#ifndef ONLINE_JUDGE
      out << "DOWN!\n";
#endif // ONLINE_JUDGE
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }
  sort(nums.begin(), nums.end());

  long long i = n / 2;
#ifndef ONLINE_JUDGE
  out << "Median index: " << i << "\n";
#endif // ONLINE_JUDGE
  long long res = 0;

#ifndef ONLINE_JUDGE
  out << "Sorted...\n";
#endif // ONLINE_JUDGE

  if (nums[i] <= s) {
#ifndef ONLINE_JUDGE
    out << "Up!\n";
#endif // ONLINE_JUDGE
    while (nums[i] < s) {
      res += abs(nums[i] - s);
      i++;
    }
  }
  else {
#ifndef ONLINE_JUDGE
    out << "Down!\n";
#endif // ONLINE_JUDGE
    while (nums[i] > s) {
      res += abs(nums[i] - s);
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  // long long n;
  in >> n >> s;
  // in >> n;
  vector<long long> nums;
  nums.resize(n);
  for (long long i=0; i<n; i++) {
    in >> nums[i];
  }

  if (n == 1) {
    out << abs(nums[0] - s) << endl;
    return;
  }

  sort(nums.begin(), nums.end());

  long long i = n / 2;
  long long res = 0;

  if (nums[i] <= s) {
    while (nums[i] < s && i < n) {
      res += abs(nums[i] - s);
      i++;
    }
  }
  else {
    while (nums[i] > s && i >= 0) {
      res += abs(nums[i] - s);
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


//
// Problem: https://codeforces.com/contest/XXXX/problem/B
// Author: montreal91
// Comment
//

#pragma GCC optimize("Ofast")

#include <algorithm>
#include <chrono>
#include <cstdint>
#include <iostream>
#include <fstream>
#include <limits>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

void function(istream& in, ostream& out) {
  ios::sync_with_stdio(false);
  in.tie(nullptr);

  long long n, s;
  in >> n >> s;
  vector<long long> nums;
  nums.resize(n);
  for (auto i=0; i<n; i++) {
    in >> nums[i];
  }

  sort(nums.begin(), nums.end());
  long long i = n / 2;
  long long res = 0;

  while (nums[i] != s) {
    res += abs(nums[i] - s);
    if (nums[i] < s) {
#ifndef ONLINE_JUDGE
      out << "UP!\n";
#endif // ONLINE_JUDGE
      i++;
    }
    else if (nums[i] > s) {
#ifndef ONLINE_JUDGE
      out << "DOWN!\n";
#endif // ONLINE_JUDGE
      i--;
    }
  }
#ifndef ONLINE_JUDGE
  out << "Res: ";
#endif // ONLINE_JUDGE
  out << res << endl;
}

int main() {
#ifndef ONLINE_JUDGE
  using namespace chrono;
  auto time1 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
#endif // ONLINE_JUDGE
  function(cin, cout);
#ifndef ONLINE_JUDGE
  auto time2 = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
  cout << "Time consumed: " << milliseconds(time2 - time1).count();
  cout << " ms.\n";
#endif // ONLINE_JUDGE
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,ans=0,q=0;
    cin>>n>>s;
    ll p=n-1,qq=0;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n)ans+=max(s-a[i],0LL);
        cout<<ans;
    }
    else
    {
        fl(i,0,n/2+1)
        ans+=max(a[i]-s,0LL);
        cout<<ans;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,ans=0,q=0;
    cin>>n>>s;
    ll p=n-1,qq=0;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n)ans+=max(s-a[i],0);
        cout<<ans;
    }
    else
    {
        fl(i,0,n/2+1)
        ans+=max(a[i]-s,0);
        cout<<ans;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,ans=0,q=0;
    cin>>n>>s;
    ll p=n-1,qq=0;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n+1)
        {
            if(a[i]>=s){p=i;break;}
        }
        fl(i,n/2,p+1)ans+=s-a[i];
        cout<<ans;
    }
    else
    {
        rfl(i,n/2,-1){if(a[i]<=s){qq=i;break;}}
        fl(i,qq,n/2+1)ans+=a[i]-s;
        cout<<ans;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,ans=0,q=0;
    cin>>n>>s;
    ll p=n-1,qq=0;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n+1)
        {
            if(a[i]>=s){p=i;break;}
        }
        fl(i,n/2,p+1)ans+=s-a[i];
        cout<<ans;
    }
    else
    {
        fl(i,0,n/2+1){if(a[i]<=s){qq=i;break;}}
        fl(i,qq,n/2+1)ans+=s-a[i];
        cout<<ans;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,ans=0,q=0;
    cin>>n>>s;
    ll p=n-1,qq=0;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n)
        {
            if(a[i]>=s){p=i;break;}
        }
        fl(i,n/2,p+1)ans+=s-a[i];
        cout<<ans;
    }
    else
    {
        fl(i,0,n/2+1){if(a[i]<=s){qq=i;break;}}
        fl(i,qq,n/2+1)ans+=s-a[i];
        cout<<ans;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,p=0,ans=0,q=0;
    cin>>n>>s;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n)
        {
            if(a[i]>=s){p=i;break;}
        }
        fl(i,n/2,p)ans+=s-a[i];
        cout<<ans;
    }
    else
    {
        fl(i,0,n/2+1){if(a[i]<=s){p=i;break;}}
        fl(i,p,n/2+1)ans+=s-a[i];
        cout<<ans;
    }
}


#include<bits/stdc++.h>
using namespace std;
#define rkc ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
#define fl(i,a,b) for(ll i=a;i<b;i++)
#define rfl(i,a,b) for(ll i=a;i>b;i--)
#define pb push_back
#define mp make_pair
#define test ll t;cin>>t;while(t--)
#define lld long double
#define vpp vector<pair<ll,ll>>
#define ff first
#define ss second
const ll M = 1e9 + 7;
const double pi  =3.141592653589793238463;
int main()
{
    rkc;
    ll n,s,ans=0,q=0;
    cin>>n>>s;
    ll p=n-1,qq=0;
    ll a[n];
    fl(i,0,n)cin>>a[i];
    sort(a,a+n);
    q=a[n/2];
    if(q==s)cout<<0;
    else if(q<s)
    {
        fl(i,n/2,n)
        {
            if(a[i]>=s){p=i;break;}
        }
        fl(i,n/2,p)ans+=s-a[i];
        cout<<ans;
    }
    else
    {
        fl(i,0,n/2+1){if(a[i]<=s){qq=i;break;}}
        fl(i,qq,n/2+1)ans+=s-a[i];
        cout<<ans;
    }
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    int n,s;
    cin>>n>>s;
    vector<int> a;
    lp(i,0,n) cin>>a[i];
    int pos = n/2;
    ll ans = 0;
    while(pos <n && a[pos] < s) ans+=s-a[pos++];
    pos = n/2;
    while(pos>=0 && a[pos] > s) ans+=a[pos--] - s;
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    int n,s;
    cin>>n>>s;
    vector<int> a(n);
    lp(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    int pos = n/2;
    ll ans = 0;
    while(pos <n && a[pos] < s) ans+=s-a[pos++];
    pos = n/2;
    while(pos>=0 && a[pos] > s) ans+=a[pos--] - s;
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    vector<int> a;
    int n,s;
    cin>>n>>s;
    a.resize(n);
    lp(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    int pos = n/2;
    ll ans = 0;
    if(a[pos]<s){
        while(pos < n && a[pos] < s) ans+=s - a[pos++];
    }else{
        while(pos >0 && a[pos] > s) ans +=a[pos++] - s;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    vector<int> a;
    int n,s;
    cin>>n>>s;
    a.resize(n);
    lp(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    int pos = n/2;
    ll ans = 0;
    while(pos<n && a[pos]<s) ans+=s - a[pos++];
    if(pos == n/2){
        while(pos > 0 && a[pos] > s) ans+=a[pos++] - s;
    }
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    int n,s;
    cin>>n>>s;
    vector<int> a(n);
    lp(i,0,n) cin>>a[i];
    int pos = n/2;
    ll ans = 0;
    while(pos <n && a[pos] < s) ans+=s-a[pos++];
    pos = n/2;
    while(pos>=0 && a[pos] > s) ans+=a[pos--] - s;
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    int n,s;
    cin>>n>>s;
    vector<int> a;
    lp(i,0,n) cin>>a[i];
    int pos = n/2;
    ll ans = 0;
    while(pos <n && a[i] < s) ans+=s-a[pos++];
    pos = n/2;
    while(pos>=0 && a[i] > s) ans+=a[pos--] - s;
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    int n,s;
    cin>>n>>s;
    vector<int> a;
    lp(i,0,n) cin>>a[i];
    int pos = n/2;
    ll ans = 0;
    while(mid <n && a[i] < s) ans+=s-a[pos++];
    pos = n/2;
    while(mid>=0 && a[i] > s) ans+=a[pos--] - s;
    cout<<ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double lld;
typedef long unsigned llu;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
#define sc(t, x) static_cast<t>(x)
#define ar(t) vector < t >
#define mp make_pair
#define pb(a) push_back(a)
#define pf push_front
#define pob pop_back
#define pof pop_front
#define ff first
#define ss second
#define lp(loop, start, end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop, start, end) for ( int loop = start; loop > end; --loop )
#define lpi(loop, start, end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop, start, end) for ( int loop = start; loop >= end; --loop )

/*
Life is a waterfall
We're one in the river
And one again after the fall

Swimming through the void
We hear the word
We lose ourselves, but we find it all...

*/

int main()
{
    ios_base::sync_with_stdio(0);
    vector<int> a;
    int n,s;
    cin>>n>>s;
    a.resize(n);
    lp(i,0,n) cin>>a[i];
    sort(a.begin(),a.end());
    int pos = n/2;
    ll ans = 0;
    while(pos<n && a[pos]<s) ans+=s - a[pos++];
    cout<<ans;
    return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	int sum = 0;
	if (a[n/2] < s) {
		for (int i = n/2; a[i]!=s && i < n; i++) sum += abs(s - a[i]);
	} else {
		for (int i = n/2; a[i]!=s && i >= 0; i--) sum += abs(s - a[i]);
	}
	cout << sum;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	//freopen("input.cpp", "r", stdin);
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	int sum = 0;
	while (a[n/2] != s) {
		if (a[n/2] > s) a[n/2]--;
		else a[n/2]++;
		sort(a, a+n);
		sum++;
	}
	cout << sum;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	long long sum = 0;
	if (a[n/2] < s) {
		for (int i = n/2; a[i]!=s && i < n; i++) sum += abs(s - a[i]);
	} else if (a[n/2] > s){
		for (int i = n/2; a[i]!=s && i >= 0; i--) sum += abs(s - a[i]);
	}
	cout << sum;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	long long sum = 0;
	if (a[n/2] < s) {
		for (int i = n/2; a[i]<s && i < n; i++) sum += abs(s - a[i]);
	} else if (a[n/2] > s){
		for (int i = n/2; a[i]>s && i >= 0; i--) sum += abs(s - a[i]);
	}
	cout << sum;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	freopen("input.cpp", "r", stdin);
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	int sum = 0;
	if (a[n/2] < s) {
		for (int i = n/2; a[i]!=s && i < n;; i++) sum += abs(s - a[i]);
	} else {
		for (int i = n/2; a[i]!=s && i >= 0; i--) sum += abs(s - a[i]);
	}
	cout << sum;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	int sum = 0;
	if (a[n/2] < s) {
		for (int i = n/2; a[i]!=s && i < n; i++) sum += abs(s - a[i]);
	} else if (a[n/2] > s){
		for (int i = n/2; a[i]!=s && i >= 0; i--) sum += abs(s - a[i]);
	}
	cout << sum;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;

int main(){
	int n, s;
	cin >> n >> s;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	sort(a, a+n);
	int sum = 0;
	if (a[n/2] < s) {
		for (int i = n/2; a[i]!=s; i++) sum += abs(s - a[i]);
	} else {
		for (int i = n/2; a[i]!=s; i--) sum += abs(s - a[i]);
	}
	cout << sum;
	return 0;
}


#include<stdio.h>
#include<stdlib.h>

typedef struct __POINT{
	double x,y;
}POINT;

int cmpfunc(const void *a,const void *b){
	POINT *ap,*bp;
	ap=(POINT *)a;bp=(POINT *)b;
	if(ap->x==bp->x)
		return ap->y>bp->y?1:-1;;
	return ap->x>bp->x?1:-1;;
}

int main(){
	int  n,p,q,i,j,k;
	double x,y;
	POINT ar[10006],sky[10006];
	scanf("%d %d %d",&n,&p,&q);
	for(i=0;i<n;i++){
		scanf("%d %d",&j,&k);
		ar[i].x=(double)j/(double)p;ar[i].y=(double)k/(double)q;
	}
	qsort(ar,n,sizeof(POINT),cmpfunc);
	//printf("After sort\n");for(i=0;i<n;i++)printf("%lf %lf\n",ar[i].x,ar[i].y);
	sky[0]=ar[n-1];
	for(i=n-2,j=1;i>=0;i--){
		if(ar[i].y>sky[j-1].y){
			sky[j++]=ar[i];
		}
	}
	n=j;
	//printf("After skyline\n");for(i=0;i<n;i++)printf("%lf %lf\n",sky[i].x,sky[i].y);
	if(sky[n-1].x>=sky[n-1].y){
		printf("%lf\n",1/sky[n-1].y);
	}
	else if(sky[0].y>=sky[0].x){
		printf("%lf\n",1/sky[0].x);
	}
	else{
		i=0,k=0;
		ar[k++]=sky[0];
		for(j=1;j<n-1;j++){
			if((sky[j].y-sky[i].y)*(sky[i].x-sky[j+1].x)>(sky[j+1].y-sky[i].y)*(sky[i].x-sky[j].x)){
				ar[k++]=sky[j];
				i=j;
			}
		}
		ar[k++]=sky[j];
		n=k;
		//printf("After hull\n");for(i=0;i<n;i++)printf("%lf %lf\n",ar[i].x,ar[i].y);
		for(i=0;i<n-1;i++){
			if(ar[i].x>=ar[i].y&&ar[i+1].x<=ar[i+1].y){
				if(ar[i+1].x==ar[i+1].y){
					printf("%lf\n",1/ar[i+1].x);
					break;
				}
				x=ar[i+1].y-ar[i].y+ar[i].x-ar[i+1].x;
				y=ar[i].x*ar[i+1].y-ar[i+1].x*ar[i].y;
				printf("%lf\n",x/y);

				//printf();
				break;
			}
		}
	}
	return 0;
}


#include <stdio.h>
#define MAXH 100010

int n, q, p;
int a[MAXH];
int b[MAXH];
int max;
double ans;
typedef long double ld;

ld f(ld x) {
    int i;

    ld y = 1;
    for(i = 0;i < n;i ++) {
        if((1 - x * a[i]) / b[i] < y) {
            y = (1 - x * a[i]) / b[i];
        }
    }
    return p * x + q * y;
}

int main() {
    int i;

    scanf("%d %d %d", &n, &p, &q);
    max = 0;
    for (i = 0;i < n;i ++) {
        scanf("%d %d", a + i, b + i);
        if(a[i] > max) max = a[i];
    }
    ld l = 0;
    ld r = 1.0 / max;
    ld tl, tr;
    for (i = 0;i < 200;i ++) {
        tl = (2 * l + r) / 3;
        tr = (2 * r + l) / 3;
        if (f(tl) > f(tr)) {
            r = tr;
        } else {
            l = tl;
        }
    }
    printf("%.15f\n", (double)f((l+r)/2));
    return 0;
}


#include <stdio.h>
#define MAXH 100010

int n, q, p;
int a[MAXH];
int b[MAXH];
int max;
double ans;
typedef long double ld;

ld f(ld x) {
    int i;

    ld y = 1;
    for(i = 0;i < n;i ++) {
        if((1 - x * a[i]) / b[i] < y) {
            y = (1 - x * a[i]) / b[i];
        }
    }
    return p * x + q * y;
}

int main() {
    int i;

    scanf("%d %d %d", &n, &p, &q);
    max = 0;
    for (i = 0;i < n;i ++) {
        scanf("%d %d", a + i, b + i);
        if(b[i] > max) max = b[i];
    }
    ld l = 0;
    ld r = 1.0 / max;
    ld tl, tr;
    for (i = 0;i < 200;i ++) {
        tl = (2 * l + r) / 3;
        tr = (2 * r + l) / 3;
        if (f(tl) > f(tr)) {
            r = tr;
        } else {
            l = tl;
        }
    }
    printf("%.15f\n", (double)f((l+r)/2));
    return 0;
}