#include <bits/stdc++.h>
using namespace std;
int n;
long long s, ans;
long long arr[300001];
int main() {
  scanf("%lld%lld", &n, &s);
  const long long mx = 1e18;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  int cur = n / 2;
  sort(arr, arr + n);
  long long lo, hi;
  lo = hi = 0;
  for (int i = cur; i < n; i++) {
    if (s <= arr[i]) break;
    hi += abs(s - arr[i]);
  }
  for (int i = cur; i >= 0; i--) {
    if (s >= arr[i]) break;
    lo += abs(s - arr[i]);
  }
  if (arr[cur] < s)
    printf("%lld\n", hi);
  else if (arr[cur] > s)
    printf("%lld\n", lo);
  else
    printf("%lld\n", min(lo, hi));
  return 0;
}
