#include <bits/stdc++.h>
using namespace std;
int n, s, a[10001000];
long long ans;
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int mid = (n / 2 + 1);
  for (int i = 1; i <= mid; i++) {
    if (a[i] > s) ans += a[i] - s, a[i] = s;
  }
  for (int i = mid; i <= n; i++) {
    if (a[i] < s) ans += s - a[i], a[i] = s;
  }
  printf("%lld", ans);
  return 0;
}
