#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
long long n, s, res;
int a[200005];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  while (cin >> n >> s) {
    res = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    int mid = n / 2 + 1;
    for (int i = mid; i <= n; i++) {
      if (a[i] < s)
        res += (s - a[i]);
      else
        break;
    }
    for (int i = mid; i >= 1; i--) {
      if (a[i] > s)
        res += (a[i] - s);
      else
        break;
    }
    cout << res << endl;
  }
  return 0;
}
