#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
long long mod(long long n) {
  return (n % 1000000007 + 1000000007) % 1000000007;
}
string test = "-------------------";
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, s;
  cin >> n >> s;
  vector<long long> vec(n);
  for (long long i = 0; i < n; ++i) {
    cin >> vec[i];
  }
  sort((vec).begin(), (vec).end());
  long long mid = n / 2;
  if (vec[mid] == s) {
    cout << 0 << "\n";
    return 0;
  }
  long long ans = 0;
  if (vec[mid] < s) {
    for (long long i = n / 2; i < n; ++i) {
      if (vec[i] < s) {
        ans += s - vec[i];
      }
    }
  } else {
    for (long long i = n / 2; i >= 0; i--) {
      if (vec[i] > s) {
        ans += vec[i] - s;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
