#include <bits/stdc++.h>
using namespace std;
bool strcm(string a, string b) {
  bool fl = true;
  if (a.length() != b.length()) {
    fl = false;
    return fl;
  }
  for (int i = 0; i < a.length(); i++) {
    if (a[i] != b[i]) {
      fl = true;
      break;
    }
  }
  return fl;
}
int main() {
  int n, s;
  cin >> n >> s;
  long long int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  sort(ar, ar + n);
  long long int ans = 0;
  for (int i = n / 2; i < n; i++) {
    if (ar[i] < s) {
      ans += abs(ar[i] - s);
    }
  }
  for (int i = n / 2; i >= 0; i--) {
    if (ar[i] > s) {
      ans += ar[i] - s;
    }
  }
  cout << ans << "\n";
  return 0;
}
