#include <bits/stdc++.h>
using namespace std;
long long a[1000010];
int main() {
  long long n, s;
  scanf("%lld %lld", &n, &s);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  sort(a, a + n);
  long long sum = 0;
  long long x = n / 2;
  if (a[x] < s) {
    while (a[x] < s) {
      sum += s - a[x];
      x++;
      if (x >= n) break;
    }
  } else if (a[x] > s) {
    while (a[x] > s) {
      sum += a[x] - s;
      x--;
      if (x < 0) break;
    }
  }
  printf("%lld\n", sum);
  return 0;
}
