#include <bits/stdc++.h>
using namespace std;
int a[200010];
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  int mid = n / 2 + 1;
  if (s == a[mid]) {
    cout << 0 << endl;
  } else if (s < a[mid]) {
    int t = mid;
    while (t >= 1 && a[t] > s) {
      t -= 1;
    }
    t += 1;
    long long res = 0;
    for (int i = t; i <= mid; i++) {
      res += a[i] - s;
    }
    cout << res << endl;
  } else if (s > a[mid]) {
    int t = mid;
    while (t <= n && a[t] < s) {
      t += 1;
    }
    t -= 1;
    long long res = 0;
    for (int i = mid; i <= t; i++) {
      res += s - a[i];
    }
    cout << res << endl;
  }
  return 0;
}
