#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
const long long int mod2 = 4294967296;
const long long int pmod = 998244353;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
bool isPrime(long long int n) {
  if (n <= 1) {
    return false;
  }
  for (long long int i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
int tests() {
  long long int n, k;
  cin >> n >> k;
  long long int a[n];
  for (long long int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long int mid = n / 2;
  long long int ans = 0;
  long long int ans2 = 0;
  if (a[mid] == k) {
    cout << 0 << "\n";
  } else if (a[mid] < k) {
    for (long long int i = mid; i < n; i++) {
      if (a[i] < k) {
        ans += abs(k - a[i]);
      }
    }
    cout << ans << "\n";
  } else {
    for (long long int i = 0; i <= mid; i++) {
      if (a[i] > k) {
        ans += abs(a[i] - k);
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t = 1;
  while (t--) {
    tests();
  }
  return 0;
}
