#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s;
  cin >> n >> s;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  if (s > v[n / 2]) {
    long long u = lower_bound(v.begin(), v.end(), s) - v.begin();
    long long ans = 0;
    for (long long i = u - 1; i >= n / 2; i--) {
      ans += s - v[i];
    }
    cout << ans;
  } else if (s < v[n / 2]) {
    long long u = upper_bound(v.begin(), v.end(), s) - v.begin();
    long long ans = 0;
    u--;
    for (long i = u + 1; i <= n / 2; i++) {
      ans += v[i] - s;
    }
    cout << ans;
  } else
    cout << 0;
}
