#include <bits/stdc++.h>
using namespace std;
int main() {
  ifstream myFile("task.in");
  if (!myFile.fail()) {
    assert(freopen("task.in", "r", stdin));
  }
  long long n, s;
  cin >> n >> s;
  long long a[n + 10];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int mid = (n / 2);
  if (s == a[mid]) {
    cout << 0;
    return 0;
  }
  long long res = abs(s - a[mid]);
  if (a[mid] < s) {
    int i = mid + 1;
    while (a[i] < s && i < n) {
      res += abs(a[i] - s);
      i++;
    }
  } else {
    int i = mid - 1;
    while (a[i] > s && i >= 0) {
      res += abs(a[i] - s);
      i--;
    }
  }
  cout << res;
  printf("\n");
  return 0;
}
