#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int n, s;
  cin >> n >> s;
  long long ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  sort(ar, ar + n);
  long long ans = 0;
  if (ar[n / 2] > s) {
    ans = ar[n / 2] - s;
    int in = n / 2;
    in--;
    while (ar[in] > s) {
      if (in < 0) break;
      ans += ar[in] - s;
      in--;
    }
  }
  if (ar[n / 2] < s) {
    ans = s - ar[n / 2];
    int in = n / 2;
    in++;
    while (ar[in] < s) {
      if (in == n) break;
      ans += s - ar[in];
      in++;
    }
  }
  cout << ans << endl;
  return 0;
}
