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