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