#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, i;
  cin >> n >> s;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long ans1 = 0, ans2 = 0;
  for (i = 0; i <= n / 2; i++) {
    if (a[i] > s) {
      ans1 += a[i] - s;
    }
  }
  for (i = n / 2; i < n; i++) {
    if (a[i] < s) {
      ans2 += s - a[i];
    }
  }
  cout << ans1 + ans2;
  return 0;
}
