#include <bits/stdc++.h>
using namespace std;
void guan() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
const long long mod2 = 1009050431;
const long long mod3 = 784514251;
const long long hash_mod[] = {998244353, 1009050431, 784514251};
const int INF = 0x7FFFFFFF;
const long long LINF = 0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const long long maxx = 1LL << 61;
const double eps = 1e-8;
const long long mod = 998244353;
const int maxn = 1010101;
int a[maxn];
int main() {
  guan();
  int n, s;
  while (cin >> n >> s) {
    for (int i = 1; i <= n; ++i) cin >> a[i];
    sort(a + 1, a + 1 + n);
    int mid = n + 1 >> 1;
    long long ans = 0;
    if (a[mid] < s) {
      for (int i = mid; i <= n; i++) {
        if (a[i] < s)
          ans += s - a[i];
        else
          break;
      }
    } else {
      for (int i = mid; i >= 1; i--) {
        if (a[i] > s)
          ans += a[i] - s;
        else
          break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
