#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double EPS = 1e-9;
const long long INF = 1e18 + 2007;
const double PI = 3.1415926535897932384626433832795;
const long long N = 200005;
vector<long long> v;
signed main() {
  ios_base::sync_with_stdio(0);
  long long n, s;
  cin >> n >> s;
  v.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort((v).begin(), (v).end());
  long long ans = 0;
  for (long long i = 0; i < n / 2; i++) {
    if (v[i] > s) {
      ans += abs(s - v[i]);
    }
  }
  for (long long i = n / 2 + 1; i < n; i++) {
    if (v[i] < s) {
      ans += abs(s - v[i]);
    }
  }
  cout << ans + abs(v[n / 2] - s);
  return 0;
}
