#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
int main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  long long int n, s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    long long int a;
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  int m = n / 2;
  if (v[m] == s) {
    cout << 0 << endl;
    return 0;
  }
  long long int ans = 0;
  if (v[m] > s) {
    int start = 0;
    while (start <= m && s > v[start]) {
      start++;
    };
    for (int i = start; i <= m; i++) {
      ans += v[i] - s;
    }
  } else {
    int end = n - 1;
    while (end >= m && s < v[end]) {
      end--;
    };
    for (int i = end; i >= m; i--) {
      ans += s - v[i];
    }
  }
  cout << ans << endl;
}
