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