#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int MAX_N = 200005;
int n;
long long s;
long long a[MAX_N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> s;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int mid = n / 2;
  long long result = abs(a[mid] - s);
  for (int i = mid - 1; i >= 0; i--)
    if (a[i] > s) result += a[i] - s;
  for (int i = mid + 1; i < n; i++)
    if (a[i] < s) result += s - a[i];
  cout << result << endl;
}
