#include <bits/stdc++.h>
using namespace std;
long long a[3000000];
int main() {
  long long int i, j, n, m, sum = 0;
  cin >> n >> m;
  j = (n + 1) / 2;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; i++) {
    sum += a[i];
    if (i == j)
      a[i] = m;
    else if (i < (j)) {
      if (a[i] > m) a[i] = m;
    } else {
      if (a[i] < m) a[i] = m;
    }
  }
  for (i = 1; i <= n; i++) {
    sum -= a[i];
  }
  cout << abs(sum) << endl;
  return 0;
}
