#include <bits/stdc++.h>
using namespace std;
long long int reach(long long int ar[], long long int n, long long int s) {
  long long int x = n / 2, sf = 0, ff = 0;
  for (long long int i = 0; i < x; i++) {
    if (ar[i] > s) ff += ar[i] - s;
    if (ar[n - 1 - i] < s) sf += s - ar[n - 1 - i];
  }
  return ff + sf + abs(ar[x] - s);
}
int main() {
  long long int n, s;
  cin >> n >> s;
  long long int ar[n];
  for (long long int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + n);
  cout << reach(ar, n, s) << endl;
  return 0;
}
