#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s;
  cin >> n >> s;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  sort(A, A + n);
  long long c = 0;
  if (s > A[n / 2]) {
    for (int i = n / 2; i < n; i++) {
      c += max(0ll, 1ll * s - A[i]);
    }
  } else if (s < A[n / 2]) {
    for (int i = n / 2; i >= 0; i--) {
      c += max(0ll, 1ll * A[i] - s);
    }
  } else {
    c = 0;
  }
  cout << c;
}
