#include <bits/stdc++.h>
int main() {
  int64_t n, s, res = 0;
  std::cin >> n >> s;
  std::vector<int64_t> inp(n);
  for (auto &k : inp) {
    std::cin >> k;
  }
  std::sort(inp.begin(), inp.end());
  int64_t mid = n / 2;
  if (inp[mid] < s) {
    for (int64_t i = mid; i < n && inp[i] < s; res += std::abs(inp[i] - s), i++)
      ;
  } else {
    for (int64_t i = mid; i >= 0 && inp[i] > s;
         res += std::abs(inp[i] - s), i--)
      ;
  }
  std::cout << res;
}
