#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, S;
  cin >> n >> S;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long z = LLONG_MAX;
  sort(a.begin(), a.end());
  long long fh = 0, sh = 0;
  for (int i = 0; i < n / 2; i++) {
    if (a[i] > S) fh += a[i] - S;
    if (a[n - 1 - i] < S) sh += S - a[n - 1 - i];
  }
  cout << fh + sh + abs(a[n / 2] - S);
  return 0;
}
