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