#include <bits/stdc++.h>
using namespace std;
int n, s;
long long int moves;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> s;
  vector<int> v(n);
  for (auto &it : v) cin >> it;
  sort(v.begin(), v.end());
  if (v[n / 2] < s) {
    for (int i = n / 2; i < n; i++) {
      if (v[i] < s)
        moves += s - v[i];
      else
        break;
    }
  } else {
    for (int i = n / 2; i >= 0; i--) {
      if (v[i] > s)
        moves += v[i] - s;
      else
        break;
    }
  }
  cout << moves << endl;
  return 0;
}
