#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 69, base = 1024 * 1024, mod = 1e9 + 7;
vector<int> vek;
int32_t main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, second;
  long long wyn = 0;
  cin >> n >> second;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    vek.push_back(a);
  }
  sort(vek.begin(), vek.end());
  if (vek[n / 2] > second) {
    for (int i = n / 2; i >= 0 && vek[i] > second; i--)
      wyn += abs(second - vek[i]);
  }
  if (vek[n / 2] < second) {
    for (int i = n / 2; i < n && vek[i] < second; i++)
      wyn += abs(second - vek[i]);
  }
  cout << wyn << "\n";
}
