#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const double PI = acos(-1);
const long long MOD = 1e9 + 7;
const int INF = 0x7FFFFFFF;
const long long LINF = 0x7FFFFFFFFFFFFFFFLL;
const unsigned long long UINF = 0xFFFFFFFFFFFFFFFFLL;
const int dCol[] = {0, +1, 0, -1, +1, +1, -1, -1};
const int dRow[] = {-1, 0, +1, 0, -1, +1, +1, -1};
template <typename T>
inline void VIN(vector<T> &i) {
  T x;
  cin >> x;
  i.push_back(x);
}
inline void FIO(string i) {
  freopen((i + ".in").c_str(), "r", stdin);
  freopen((i + ".out").c_str(), "w", stdout);
}
int N, S, data[200005], median;
long long ans = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> S;
  for (int i = (0); i < (N); i++) cin >> data[i];
  sort(data, data + N);
  median = data[N / 2];
  if (S > median) {
    for (int i = (N / 2); i < (N); i++)
      if (data[i] < S) ans += abs(data[i] - S);
  } else if (S < median) {
    for (int i = (N / 2); i >= (0); i--)
      if (data[i] > S) ans += abs(data[i] - S);
  }
  cout << ans << "\n";
  return 0;
}
