#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a);
    b = b >> 1;
    a = (a * a);
  }
  return ans;
}
long long int modInverse(long long int n, long long int m,
                         long long int mod = 1000000007) {
  return power(n, m - 2) % mod;
}
long long int sieve[1000001];
void factors(long long int num, set<long long int> &s) {
  if (num <= 1) return;
  s.insert(sieve[num]);
  factors(num / sieve[num], s);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, s;
  cin >> n >> s;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long int ans = 0;
  if (a[n / 2] < s) {
    for (long long int i = n / 2; i < n; i++) {
      if (a[i] < s) ans += abs(a[i] - s);
    }
  } else if (a[n / 2] > s) {
    for (long long int i = n / 2; i >= 0; i--) {
      if (a[i] > s) ans += abs(a[i] - s);
    }
  }
  cout << ans << endl;
  return 0;
}
