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