#include <bits/stdc++.h>
using namespace std;
int A[200005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int N, S;
  cin >> N >> S;
  for (int i = 1; i <= N; i++) cin >> A[i];
  sort(A + 1, A + 1 + N);
  int mid = (N + 1) / 2;
  long long ans = 0;
  if (A[mid] >= S) {
    for (int i = mid; i >= 1 && A[i] > S; i--) ans += (A[i] - S);
  } else {
    for (int i = mid; i <= N && A[i] < S; i++) ans += (S - A[i]);
  }
  cout << ans << "\n";
  return 0;
}
