#include <bits/stdc++.h>
using namespace std;
const int inf_int = 1e9 + 100;
const long long inf_ll = 1e16;
const double pi = 3.1415926535898;
bool debug = 0;
const int MX = 6e6 + 1;
const int MAXN = 4e5 + 100;
const int LOG = 20;
const long long mod = 1e9 + 7;
void solve() {
  int n, s;
  cin >> n >> s;
  vector<int> a;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  long long ans = 0;
  if (a[n / 2] > s) {
    for (int i = n / 2; i >= 0; --i) {
      if (a[i] > s) {
        ans += a[i] - s;
      }
    }
  } else if (a[n / 2] < s) {
    for (int i = n / 2; i < n; ++i) {
      if (a[i] < s) {
        ans += s - a[i];
      }
    }
  }
  cout << ans << "\n";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  int t = 1;
  while (t--) solve();
}
