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