#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n, s, a[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  for (long long i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  long long mid = n / 2, ans = 0;
  ans += abs(a[mid] - s);
  for (long long i = mid + 1; i < n; i++) ans += max(0LL, s - a[i]);
  for (long long i = 0; i < mid; i++) ans += max(0LL, a[i] - s);
  cout << ans;
  return 0;
}
