#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  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());
  long long midpos = (n - 1) / 2;
  long long ans = 0;
  for (long long i = midpos; i >= 0; i--) {
    if (v[i] >= s) {
      ans += (v[i] - s);
      v[i] = s;
    }
  }
  for (long long i = midpos; i < n; i++) {
    if (v[i] <= s) {
      ans += (s - v[i]);
      v[i] = s;
    }
  }
  cout << ans << endl;
  return 0;
}
