#include <bits/stdc++.h>
using namespace std;
template <typename Q>
void inin(Q &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x = f ? -x : x;
}
long long n, a[200020], s;
int main() {
  inin(n), inin(s);
  for (int i = (1); i <= (n); i++) inin(a[i]);
  sort(a + 1, a + n + 1);
  long long sum = 0;
  sum += abs(a[n / 2 + 1] - s);
  a[n / 2 + 1] = s;
  for (int i = (1); i <= (n / 2); i++)
    if (a[i] > s) sum += abs(a[i] - s);
  for (int i = (n / 2 + 2); i <= (n); i++)
    if (a[i] < s) sum += abs(a[i] - s);
  cout << sum;
  return 0;
}
