#include <bits/stdc++.h>
using namespace std;
long long n, k, mid, ans;
const int N = 200005;
long long a[N];
int main() {
  scanf("%lld%lld", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  sort(a + 1, a + 1 + n);
  mid = (n + 1) / 2;
  for (int i = 1; i <= mid; ++i) {
    if (a[i] > k) ans += a[i] - k;
  }
  for (int i = mid; i <= n; ++i) {
    if (a[i] < k) ans += k - a[i];
  }
  printf("%lld\n", ans);
  return 0;
}
