#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, second;
  cin >> n >> second;
  long long *a = new long long[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long moves = 0;
  for (long long i = 0; i < n / 2; i++) {
    if (a[i] > second) moves += a[i] - second;
  }
  for (long long i = n - 1; i > n / 2; i--) {
    if (a[i] < second) moves += second - a[i];
  }
  moves += abs(a[n / 2] - second);
  cout << moves;
  return 0;
}
