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