#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
int main() {
  int n, i, s;
  scanf("%d %d", &n, &s);
  vector<int> a(n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  long long res = 0;
  int pos = n / 2;
  if (a[pos] <= s) {
    for (i = pos; i < n; i++) res += max(0, s - a[i]);
  } else {
    for (i = 0; i <= pos; i++) res += max(0, a[i] - s);
  }
  cout << res << endl;
}
