#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s;
  cin >> n >> s;
  long long count = 0;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long long mid = n / 2;
  count += abs(arr[mid] - s);
  arr[mid] = s;
  for (long long i = mid - 1; i >= 0; i--) {
    if (arr[i] > arr[i + 1]) {
      count += abs(arr[i] - arr[i + 1]);
      arr[i] = arr[i + 1];
    }
  }
  for (long long i = mid + 1; i < n; i++) {
    if (arr[i] < arr[i - 1]) {
      count += abs(arr[i] - arr[i - 1]);
      arr[i] = arr[i - 1];
    }
  }
  cout << count;
}
