#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
int a[200005];
int n, s;
long long ans;
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int mid = n + 1 >> 1;
  ans = abs(s - a[mid]);
  for (int i = 1; i < mid; i++)
    if (a[i] > s) ans += a[i] - s;
  for (int i = mid + 1; i <= n; i++)
    if (a[i] < s) ans += s - a[i];
  cout << ans << endl;
  return 0;
}
