#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s;
  cin >> n >> s;
  long long int a[n], c = 0;
  for (long long int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int l = n / 2;
  if (a[l] != s) {
    for (long long int i = 0; i <= l; i++) {
      if (a[i] > s) c += a[i] - s;
    }
    for (long long int i = l; i < n; i++) {
      if (a[i] < s) c += s - a[i];
    }
  }
  cout << c << endl;
}
