#include <bits/stdc++.h>
using namespace std;
bool prime[1000001];
const double gr = 1.6180339887;
void SieveOfErat(long long int mn) {
  memset(prime, true, sizeof(prime));
  for (long long i = 2; i * i <= mn; i++) {
    if (prime[i] == true) {
      for (long long j = i * 2; j <= 1000000; j += i) prime[j] = false;
    }
  }
}
long long int n, s;
vector<long long int> a;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    a.push_back(x);
  }
  long long int cnt = 0;
  long long int poss = n / 2;
  sort(a.begin(), a.end());
  long long int pos = lower_bound(a.begin(), a.end(), s) - a.begin();
  if (s < a[0] || s > a[n - 1]) pos = -1;
  if (pos == -1) {
    if (a[0] > s) {
      for (long long int i = 0; i <= poss; i++) cnt += abs(a[i] - s);
    } else if (a[n - 1] < s) {
      for (long long int i = poss; i < n; i++) cnt += abs(a[i] - s);
    }
    cout << cnt << endl;
    return 0;
  }
  long long int med = a[n / 2];
  if (pos == poss) {
    cout << abs(a[poss] - s) << endl;
    return 0;
  }
  if (a[pos] >= med) {
    for (long long int i = poss; i < pos; i++) {
      cnt += abs(a[i] - s);
    }
  } else {
    for (long long int i = pos; i <= poss; i++) {
      cnt += abs(a[i] - s);
    }
  }
  cout << cnt << endl;
  return 0;
}
