#include <bits/stdc++.h>
using namespace std;
template <long long D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(long long n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(long long n = 0, const T &val = T()) : vector<T>(n, val) {}
};
template <typename T>
void printv(vector<T> v) {
  for (auto e : v) {
    cout << e << " ";
  }
  cout << "\n";
}
template <typename T>
void printvv(vector<T> vv) {
  for (long long i = 0; i < vv.size(); i++) {
    cout << i << ": ";
    for (auto e : vv[i]) {
      cout << e << " ";
    }
    cout << "\n";
  }
}
void __print(long long x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long cnt_leq_x(vector<long long> &a, long long x) {
  long long ret = upper_bound(a.begin(), a.end(), x) - a.begin();
  return ret;
}
long long cnt_lt_x(vector<long long> &a, long long x) {
  long long ret = lower_bound(a.begin(), a.end(), x) - a.begin();
  return ret;
}
long long cnt_geq_x(vector<long long> &a, long long x) {
  long long ret = a.end() - lower_bound(a.begin(), a.end(), x);
  return ret;
}
long long cnt_gt_x(vector<long long> &a, long long x) {
  long long ret = a.end() - upper_bound(a.begin(), a.end(), x);
  return ret;
}
bool mul_overflow(long long a, long long b) {
  long long c;
  return __builtin_mul_overflow(a, b, &c);
}
struct FenwickTree {
  long long n;
  vector<long long> arr;
  FenwickTree(long long n) {
    this->n = n;
    arr.assign(n, 0);
  }
  FenwickTree(vector<long long> a) : FenwickTree((long long)a.size()) {
    for (long long i = 0; i < (long long)a.size(); i++) {
      add(i, a[i]);
    }
  }
  long long sum(long long i) {
    long long ret = 0;
    while (i > 0) {
      ret += arr[i];
      i -= i & -i;
    }
    return ret;
  }
  long long sum(long long l, long long r) { return sum(r) - sum(l - 1); }
  void add(long long i, long long delta) {
    while (i < n) {
      arr[i] += delta;
      i += i & -i;
    }
  }
};
struct segtree {
  long long size;
  vector<long long> arr;
  const long long identity = 1;
  long long single(long long v) { return v; }
  long long merge(long long a, long long b) { return a * b; }
  void init(long long n) {
    size = 1;
    while (size < n) size *= 2;
    arr.assign(2 * size, identity);
  }
  void build(vector<long long> &a, long long x, long long lx, long long rx) {
    if (rx - lx == 1) {
      if (0 <= lx && lx < (long long)a.size()) {
        arr[x] = single(a[lx]);
      }
      return;
    }
    long long m = (lx + rx) / 2;
    build(a, 2 * x + 1, lx, m);
    build(a, 2 * x + 2, m, rx);
    arr[x] = merge(arr[2 * x + 1], arr[2 * x + 2]);
  }
  void build(vector<long long> &a) { build(a, 0, 0, size); }
  void set(long long i, long long v, long long x, long long lx, long long rx) {
    if (rx - lx == 1) {
      arr[x] = single(v);
      return;
    }
    long long m = (lx + rx) / 2;
    if (i < m)
      set(i, v, 2 * x + 1, lx, m);
    else
      set(i, v, 2 * x + 2, m, rx);
    arr[x] = merge(arr[2 * x + 1], arr[2 * x + 2]);
  }
  void set(long long i, long long v) { set(i, v, 0, 0, size); }
  long long calc(long long l, long long r, long long x, long long lx,
                 long long rx) {
    if (r <= lx || rx <= l) return identity;
    if (l <= lx && rx <= r) return arr[x];
    long long m = (lx + rx) / 2;
    long long left = calc(l, r, 2 * x + 1, lx, m);
    long long right = calc(l, r, 2 * x + 2, m, rx);
    return merge(left, right);
  }
  long long calc(long long l, long long r) { return calc(l, r, 0, 0, size); }
  long long find(long long k, long long l, long long x, long long lx,
                 long long rx) {
    if (rx - lx == 1) {
      if (0 <= lx && lx <= size) {
        if (arr[x] >= k && lx >= l)
          return lx;
        else
          return -1;
      }
    }
    long long m = (lx + rx) / 2;
    long long left = arr[2 * x + 1];
    if (l < m && k <= left) {
      long long temp = find(k, l, 2 * x + 1, lx, m);
      if (temp == -1)
        return find(k, l, 2 * x + 2, m, rx);
      else
        return temp;
    } else {
      return find(k, l, 2 * x + 2, m, rx);
    }
  }
  long long find(long long k, long long l) { return find(k, l, 0, 0, size); }
};
void io_util() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(17);
}
signed main() {
  io_util();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    long long x;
    cin >> n >> x;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    bool all_eq_x = true;
    bool some_eq_x = false;
    for (long long i = 0; i < n; i++) {
      if (a[i] != x)
        all_eq_x = false;
      else
        some_eq_x = true;
    }
    if (all_eq_x) {
      cout << 0 << "\n";
      continue;
    }
    long long s = 0;
    for (long long i = 0; i < n; i++) s += a[i];
    if (n * x == s || some_eq_x) {
      cout << 1 << "\n";
      continue;
    } else {
      cout << 2 << "\n";
    }
  }
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

A new agent called Killjoy invented a virus COVID-2069 that infects accounts on Codeforces. Each account has a rating, described by an integer (it can possibly be negative or very large).

Killjoy's account is already infected and has a rating equal to x. Its rating is constant. There are n accounts except hers, numbered from 1 to n. The i-th account's initial rating is a_i. Any infected account (initially the only infected account is Killjoy's) instantly infects any uninfected account if their ratings are equal. This can happen at the beginning (before any rating changes) and after each contest. If an account is infected, it can not be healed.

Contests are regularly held on Codeforces. In each contest, any of these n accounts (including infected ones) can participate. Killjoy can't participate. After each contest ratings are changed this way: each participant's rating is changed by an integer, but the sum of all changes must be equal to zero. New ratings can be any integer.

Find out the minimal number of contests needed to infect all accounts. You can choose which accounts will participate in each contest and how the ratings will change.

It can be proven that all accounts can be infected in some finite number of contests.

Input

The first line contains a single integer t (1 ≤ t ≤ 100) — the number of test cases. The next 2t lines contain the descriptions of all test cases.

The first line of each test case contains two integers n and x (2 ≤ n ≤ 10^3, -4000 ≤ x ≤ 4000) — the number of accounts on Codeforces and the rating of Killjoy's account.

The second line of each test case contains n integers a_1, a_2, ..., a_n (-4000 ≤ a_i ≤ 4000) — the ratings of other accounts.

Output

For each test case output the minimal number of contests needed to infect all accounts.

Example

Input


3
2 69
68 70
6 4
4 4 4 4 4 4
9 38
-21 83 50 -59 -77 15 -71 -78 20


Output


1
0
2

Note

In the first test case it's possible to make all ratings equal to 69. First account's rating will increase by 1, and second account's rating will decrease by 1, so the sum of all changes will be equal to zero.

In the second test case all accounts will be instantly infected, because all ratings (including Killjoy's account's rating) are equal to 4.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <long long D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(long long n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(long long n = 0, const T &val = T()) : vector<T>(n, val) {}
};
template <typename T>
void printv(vector<T> v) {
  for (auto e : v) {
    cout << e << " ";
  }
  cout << "\n";
}
template <typename T>
void printvv(vector<T> vv) {
  for (long long i = 0; i < vv.size(); i++) {
    cout << i << ": ";
    for (auto e : vv[i]) {
      cout << e << " ";
    }
    cout << "\n";
  }
}
void __print(long long x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long cnt_leq_x(vector<long long> &a, long long x) {
  long long ret = upper_bound(a.begin(), a.end(), x) - a.begin();
  return ret;
}
long long cnt_lt_x(vector<long long> &a, long long x) {
  long long ret = lower_bound(a.begin(), a.end(), x) - a.begin();
  return ret;
}
long long cnt_geq_x(vector<long long> &a, long long x) {
  long long ret = a.end() - lower_bound(a.begin(), a.end(), x);
  return ret;
}
long long cnt_gt_x(vector<long long> &a, long long x) {
  long long ret = a.end() - upper_bound(a.begin(), a.end(), x);
  return ret;
}
bool mul_overflow(long long a, long long b) {
  long long c;
  return __builtin_mul_overflow(a, b, &c);
}
struct FenwickTree {
  long long n;
  vector<long long> arr;
  FenwickTree(long long n) {
    this->n = n;
    arr.assign(n, 0);
  }
  FenwickTree(vector<long long> a) : FenwickTree((long long)a.size()) {
    for (long long i = 0; i < (long long)a.size(); i++) {
      add(i, a[i]);
    }
  }
  long long sum(long long i) {
    long long ret = 0;
    while (i > 0) {
      ret += arr[i];
      i -= i & -i;
    }
    return ret;
  }
  long long sum(long long l, long long r) { return sum(r) - sum(l - 1); }
  void add(long long i, long long delta) {
    while (i < n) {
      arr[i] += delta;
      i += i & -i;
    }
  }
};
struct segtree {
  long long size;
  vector<long long> arr;
  const long long identity = 1;
  long long single(long long v) { return v; }
  long long merge(long long a, long long b) { return a * b; }
  void init(long long n) {
    size = 1;
    while (size < n) size *= 2;
    arr.assign(2 * size, identity);
  }
  void build(vector<long long> &a, long long x, long long lx, long long rx) {
    if (rx - lx == 1) {
      if (0 <= lx && lx < (long long)a.size()) {
        arr[x] = single(a[lx]);
      }
      return;
    }
    long long m = (lx + rx) / 2;
    build(a, 2 * x + 1, lx, m);
    build(a, 2 * x + 2, m, rx);
    arr[x] = merge(arr[2 * x + 1], arr[2 * x + 2]);
  }
  void build(vector<long long> &a) { build(a, 0, 0, size); }
  void set(long long i, long long v, long long x, long long lx, long long rx) {
    if (rx - lx == 1) {
      arr[x] = single(v);
      return;
    }
    long long m = (lx + rx) / 2;
    if (i < m)
      set(i, v, 2 * x + 1, lx, m);
    else
      set(i, v, 2 * x + 2, m, rx);
    arr[x] = merge(arr[2 * x + 1], arr[2 * x + 2]);
  }
  void set(long long i, long long v) { set(i, v, 0, 0, size); }
  long long calc(long long l, long long r, long long x, long long lx,
                 long long rx) {
    if (r <= lx || rx <= l) return identity;
    if (l <= lx && rx <= r) return arr[x];
    long long m = (lx + rx) / 2;
    long long left = calc(l, r, 2 * x + 1, lx, m);
    long long right = calc(l, r, 2 * x + 2, m, rx);
    return merge(left, right);
  }
  long long calc(long long l, long long r) { return calc(l, r, 0, 0, size); }
  long long find(long long k, long long l, long long x, long long lx,
                 long long rx) {
    if (rx - lx == 1) {
      if (0 <= lx && lx <= size) {
        if (arr[x] >= k && lx >= l)
          return lx;
        else
          return -1;
      }
    }
    long long m = (lx + rx) / 2;
    long long left = arr[2 * x + 1];
    if (l < m && k <= left) {
      long long temp = find(k, l, 2 * x + 1, lx, m);
      if (temp == -1)
        return find(k, l, 2 * x + 2, m, rx);
      else
        return temp;
    } else {
      return find(k, l, 2 * x + 2, m, rx);
    }
  }
  long long find(long long k, long long l) { return find(k, l, 0, 0, size); }
};
void io_util() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.precision(17);
}
signed main() {
  io_util();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    long long x;
    cin >> n >> x;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    bool all_eq_x = true;
    bool some_eq_x = false;
    for (long long i = 0; i < n; i++) {
      if (a[i] != x)
        all_eq_x = false;
      else
        some_eq_x = true;
    }
    if (all_eq_x) {
      cout << 0 << "\n";
      continue;
    }
    long long s = 0;
    for (long long i = 0; i < n; i++) s += a[i];
    if (n * x == s || some_eq_x) {
      cout << 1 << "\n";
      continue;
    } else {
      cout << 2 << "\n";
    }
  }
  return 0;
}

```