#include <bits/stdc++.h>
using namespace std;
const int N = 2e5;
int n, s;
int a[N + 87];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  if (a[n / 2] == s) {
    cout << 0 << endl;
  } else if (a[n / 2] < s) {
    long long int ans = 0;
    for (int i = n / 2; i < n && a[i] < s; i++) ans += s - a[i];
    cout << ans << endl;
  } else {
    long long int ans = 0;
    for (int i = n / 2; i >= 0 && a[i] > s; i--) ans += a[i] - s;
    cout << ans << endl;
  }
}
