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 \le t \le 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 \le n \le 10^3$, $-4000 \le x \le 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, \dots, a_n$ $(-4000 \le a_i \le 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$.

Difficulty: interview

Starter code:

Solutions:
import sys
import random
from fractions import Fraction
from math import *
 
def input():
    return sys.stdin.readline().strip()
 
def iinput():
    return int(input())

def finput():
    return float(input())

def tinput():
    return input().split()

def linput():
    return list(input())
 
def rinput():
    return list(map(int, tinput()))

def fiinput():
    return list(map(float, tinput()))
 
def rlinput():
    return list(map(int, input().split()))
def trinput():
    return tuple(rinput())

def srlinput():
    return sorted(list(map(int, input().split())))

def NOYES(fl):
    if fl:
        print("NO")
    else:
        print("YES")
def YESNO(fl):
    if fl:
        print("YES")
    else:
        print("NO")
    
def main():
    #n = iinput()
    #k = iinput() 
    #m = iinput() 
    #n = int(sys.stdin.readline().strip()) 
    n, k = rinput()
    #n, m = rinput()
    #m, k = rinput()
    #n, k, m = rinput()
    #n, m, k = rinput()
    #k, n, m = rinput()
    #k, m, n = rinput() 
    #m, k, n = rinput()
    #m, n, k = rinput()
    q = srlinput()
    #q = linput()
    print((q.count(k) != n) * (k in q) + (1 + (k * n != sum(q))) * (k not in q))
         
    
                
    
    
    
            
    
        
    

for i in range(iinput()):
    main()


for _ in range(int(input())):
  n,x=map(int,input().split())
  a=list(map(int,input().split()))
  if a==[x]*n:
    print(0)
  elif sum(i-x for i in a)==0 or x in a:
    print(1)
  else:
    print(2)

y=lambda:map(int,input().split())
for _ in range(int(input())):
 n,x=y()
 a=[*y()]
 if all(i==x for i in a):print(0);continue
 if x in a or sum(a)==x*n:print(1);continue
 print(2)

for _ in range(int(input())):
    n, x = tuple(map(int, input().split()))
    arr = list(map(int, input().split()))

    if all(i == x for i in arr):
        print(0)
    elif sum(i - x for i in arr) == 0 or any(i == x for i in arr):
        print(1)
    else:
        print(2)


import math
t = int(input())
while t>0:
  n,x = list(map(int, input().split()))
  a = list(map(int, input().split()))
  if all(val==x for val in a):
    print("0")
  elif any(val==x for val in a):
    print("1")
  elif sum(x-val for val in a) == 0:
    print("1")
  else:
    print("2")
  t -= 1


t=int(input())
for you in range(t):
    l=input().split()
    n=int(l[0])
    x=int(l[1])
    l=input().split()
    li=[int(i) for i in l]
    poss=1
    for i in li:
        if(i!=x):
            poss=0
            break
    if(poss):
        print(0)
        continue
    poss=0
    for i in li:
        if(i==x):
            poss=1
            break
    if(poss):
        print(1)
        continue
    z=sum(li)
    if(z==n*x):
        print(1)
        continue
    print(2) 


t = int(input())
for _ in range(t):
  n, x = [int(i) for i in input().split(" ")]
  a = [int(i) for i in input().split(" ")]
  diff = sum(a) - n*x
  if diff == 0:
    if max(a) == min(a):
      print(0)
    else:
      print(1)
  else:
    if x in a:
      print(1)
    else:
      print(2)

from collections import defaultdict
from queue import deque


def arrinp():
    return [*list(map(int, input().split(' ')))]


def mulinp():
    return list(map(int, input().split(' ')))


def intinp():
    return int(input())


def solution():
    n,x = mulinp()
    a = arrinp()
    if len(set(a)) == 1:
        if a[0] == x:
            print(0)
        else:
            print(2)
        return
    count = 0
    s = 0
    for i in range(n):
        s += a[i]
        if a[i] == x:
            count += 1
    if count != 0:
        print(1)
    elif s/n == x:
        print(1)
    else:
        print(2)
    
    return


testcases = 1
testcases = int(input())
for _ in range(testcases):
    solution()


T = int(input())
for _ in range(T):
    N, X = list(map(int, input().split()))
    A = [int(a) for a in input().split()]
    if A.count(X) == N:
        print(0)
    elif sum(A) == N * X or A.count(X) > 0:
        print(1)
    else:
        print(2)




from collections import  Counter
for _ in range(int(input())):
    n,x = list(map(int,input().split()))
    l = list(map(int,input().split()))
    k = 0
    c = 0
    for i in l:
        k+=(x-i)
        if i == x:
            c+=1
    if c == n:
        print(0)
    else:
        if c >=1:
            print(1)
        else:
            if k == 0:
                print(1)
            else:
                print(2)
    
    


import sys
ii = lambda: sys.stdin.readline().strip()
idata = lambda: [int(x) for x in ii().split()]

def solve():
    n, x = idata()
    data = idata()
    flag = 0
    summ = 0
    for i in range(n):
        summ += data[i]
        if data[i] == x:
            flag += 1
    if flag == n:
        print(0)
        return
    if flag:
        print(1)
        return
    if summ // n == x and summ % n == 0:
        print(1)
        return
    print(2)
    return

for t in range(int(ii())):
    solve()


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
    n, x = map(int,input().split())
    A = list(map(int,input().split()))
    B = []
    c = A.count(x)
    for i in range(n):
        if A[i] != x:
            B.append(A[i])

    if B == []:
        print(0)
    elif c > 0 or sum(B) == x*len(B):
        print(1)
    else:
        print(2)

t = int(input())
for _ in range(t):
    n, x = map(int, input().split())
    a = list(map(int, input().split()))
    f=True
    g=False
    s=0
    for i in range(n):
        if a[i]==x:
            g=True
        if a[i]!=x:
            f=False
        s+=a[i]-x
    if f:
        print(0)
    elif s==0:
        print(1)
    else:
        if g:
            print(1)
        else:
            print(2)

t = int(input())
for tt in range(t):
	n, m = list(map(int, input().split()))
	a = list(map(int, input().split()))
	if len(set(a)) == 1 and m in a:
		print(0)
	elif sum(a) == n * m or m in a:
		print(1)
	else:
		print(2)


for _ in range(int(input())):
    n, x = list(map(int, input().split()))
    arr = list(map(int, input().split()))
    if set(arr) == {x}:
        print(0)
        continue
    s = sum(arr)
    if s//n*n == s and s//n == x or x in arr:
        print(1)
    else:
        print(2)


q = int(input())
for _ in range(q):
    n, x = map(int,input().split())
    l = list(map(int,input().split()))
    g = l.count(x)
    dup = sum(l)
    if g == 0:
        if dup == x*n:
            print(1)
        else:
            print(2)
    else:
        if l == [x]*n:
            print(0)
        else:
           print(1)

#!/usr/bin/env python3
import sys
input = sys.stdin.readline

t = int(input())
for _ in range(t):
    n, x = map(int, input().split())
    a = [int(item) for item in input().split()]
    all_same = True
    has_same = False
    for item in a:
        if item != x:
            all_same = False
        if item == x:
            has_same = True
    if all_same:
        print(0)
        continue
    if sum(a) == x * n or has_same:
        print(1)
        continue
    print(2)

for _ in range(int(input())):
    n, x = list(map(int, input().split()))
    a = list(map(int, input().split()))
    print(0 if a == [x] * n else 1 if x in a or sum(x - y for y in a[1:]) == a[0] - x else 2)


def read_line():
    return list(map(int, input().split()))

T = int(input())
for _ in range(T):
    n, x = list(map(int, input().split()))
    l = read_line()
    t = 0
    all_eq = True
    has_eq = False
    for a in l:
        t += a - x
        if a != x:
            all_eq = False
        else:
            has_eq = True
    if all_eq:
        print(0)
    elif t == 0 or has_eq:
        print(1)
    else:
        print(2)



t = int(input())
for _ in range(t):
	n, x = list(map(int, input().split()))
	arr = [int(j) for j in input().split()]

	c = arr.count(x)
	if c == n:
		print(0)
		continue
	elif c > 0:
		print(1)
		continue

	net = 0
	for i in range(n):
		net += arr[i]-x

	if net == 0:
		print(1)
	else:
		print(2)