#include <bits/stdc++.h>
using namespace std;
const int NMAX = 200000 + 5;
int n, s, a[NMAX];
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  sort(a, a + n);
  int mid = n / 2;
  if (a[mid] == s) {
    cout << 0 << '\n';
  } else {
    long long cnt = 0;
    if (a[mid] < s) {
      for (; mid < n && a[mid] < s; ++mid) cnt += (long long)s - a[mid];
    } else {
      for (; mid >= 0 && a[mid] > s; --mid) cnt += (long long)a[mid] - s;
    }
    cout << cnt << '\n';
  }
  return 0;
}
