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