#include <bits/stdc++.h>
using namespace std;
const int N = 200008;
long long n, m, nn, a[N];
long long absx(long long x) {
  if (x < 0) x = -x;
  return x;
}
int main(void) {
  std::ios::sync_with_stdio(false);
  long long i, s1;
  cin >> n >> m;
  nn = (n + 1) / 2;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  if (a[nn] == m) {
    cout << 0;
    return 0;
  }
  if (a[nn] < m) {
    s1 = m - a[nn];
    for (i = nn + 1; i <= n; i++)
      if (a[i] < m) s1 += m - a[i];
    cout << s1;
    return 0;
  }
  if (a[nn] > m) {
    s1 = a[nn] - m;
    for (i = 1; i < nn; i++)
      if (a[i] > m) s1 += a[i] - m;
    cout << s1;
    return 0;
  }
  return 0;
}
