You are given an array of N integers a1, a2, ..., aN and an integer K. Find the number of such unordered pairs {i, j} that 

- i ≠ j
- |ai + aj - K| is minimal possible

Output  the minimal possible value of |ai + aj - K| (where i ≠ j) and the number of such pairs for the given array and the integer K.

-----Input-----
The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.

The first line of each test case consists of two space separated integers - N and K respectively.

The second line contains N single space separated integers - a1, a2, ..., aN respectively.

-----Output-----
For each test case, output a single line containing two single space separated integers - the minimal possible value of |ai + aj - K| and the number of unordered pairs {i, j} for which this minimal difference is reached.

-----Constraints-----

- 1 ≤ T ≤ 50
- 1 ≤ ai, K ≤ 109
- N = 2 - 31 point.
- 2 ≤ N ≤ 1000 - 69 points.

-----Example-----
Input:
1   
4 9
4 4 2 6

Output:
1 4

-----Explanation:-----
The minimal possible absolute difference of 1 can be obtained by taking the pairs of a1 and a2, a1 and a4, a2 and a4, a3 and a4.

Starter code:

Solutions:
for _ in range(int(input())):
 n,k=list(map(int, input().split()))
 l=list(map(int, input().split()))
 l.sort()
 
 c=0
 mn=abs(l[0]+l[1]-k)
 for i in range(n-1):
  for j in range(i+1, n):
   temp=abs(l[i]+l[j]-k)
   if temp==mn:
    c+=1 
    
   elif temp<mn:
    mn=temp
    c=1 
    
   elif l[i]+l[j]-k>mn:
    break
 
 print(mn, c)

for u in range(int(input())):
 n,k=map(int,input().split())
 l=list(map(int,input().split()))
 d=[]
 for i in range(n):
  for j in range(i+1,n):
   d.append(abs(l[i]+l[j]-k))
 print(min(d),d.count(min(d)))

from collections import *
for u in range(int(input())):
 n,k=list(map(int,input().split()))
 l=list(map(int,input().split()))
 d=[]
 x=100000000000000
 for i in range(n-1):
  for j in range(i+1,n):
   x=min(x,abs(l[i]+l[j]-k))
   d.append(abs(l[i]+l[j]-k))
 print(x,d.count(x))


# cook your dish here
for _ in range(int(input())):
 n,k=map(int,input().split())
 arr=list(map(int,input().split()))
 stack=[]
 for i in range(len(arr)):
  for j in range(i+1,len(arr)):
   stack.append(abs(arr[i]+arr[j]-k))
 print(min(stack),stack.count(min(stack)))

for _ in range(int(input())):
 n,k=map(int,input().split())
 l=list(map(int,input().split()))
 aux=[]
 for i in range(len(l)):
  for j in range(i+1,len(l)):
   aux.append(abs(l[i]+l[j]-k))
 m=min(aux)
 t_1=aux.count(m)
 print(m,t_1)

t=int(input())
for i in range(t):
 l=[]
 mi=99999999999
 n,m=list(map(int,input().split()))
 a=list(map(int,input().split()))
 for j in range(n-1):
  for k in range(j+1,n):
   a1=a[j]
   a2=a[k]
   b1=a1+a2-m
   b2=abs(b1)
   l.append(b2)
   if(mi>b2):
    mi=b2
    
 print(mi,l.count(mi)) 
   


# cook your dish here
t=int(input())
while t:
 n, k = [int (x) for x in input().split()]
 arr=[int(x) for x in input().split()]
 num=[[0 for i in range(n)] for j in range(n)]
 i=0
 j=0
 count=0
 while i<n:
  while j<n:
   num[i][j]=arr[i]+arr[j]
   j=j+1
  i=i+1 
  j=0
 min =1000000000000000
 i=0
 j=0
 while i<n:
  while j<n:
   if abs(num[i][j]-k)==min and i != j:
    count=count+1
   elif abs(num[i][j]-k)<=min and i !=j:
    min=abs(num[i][j]-k)
    count=1
   j=j+1
  i=i+1
  j=i
 print("{} {}".format(min,count))
 t=t-1

t=int(input())
while(t>0):
 n,k=map(int,input().split())
 l=list(map(int,input().split()))
 x=3*10**9
 a=[]
 for i in range(n):
  for j in range(i+1,n):
   a.append(abs(l[j]+l[i]-k))
 m=min(a)
 print(m,a.count(m))
 t-=1

t=int(input())
while(t>0):
 n,k=map(int,input().split())
 l=list(map(int,input().split()))
 x=3*10**9
 c=0
 for i in range(n):
  for j in range(i+1,n):
   y=abs(l[j]+l[i]-k)
   if(y<x):
    x=y
 for i in range(n):
  for j in range(i+1,n):
   if(abs(l[j]+l[i]-k)==x):
    c+=1
 print(x,c)
 t-=1

for i in range(int(input())):
 n,k=list(map(int,input().split()))
 a=list(map(int,input().split()))
 ind=1
 m=float('inf')
 for i in range(n):
  for j in range(i+1,n):
    if m>abs(a[i]+a[j]-k):
     m=abs(a[i]+a[j]-k)
     ind=1
    elif m==abs(a[i]+a[j]-k):
     ind+=1
 print(m,ind)


for i in range(int(input())):
 n,k=list(map(int,input().split()))
 a=list(map(int,input().split()))
 ind=1
 m=10**10
 for i in range(n):
  for j in range(i+1,n):
    if abs(m)>abs(a[i]+a[j]-k):
     m=abs(a[i]+a[j]-k)
     ind=1
    elif abs(m)==abs(a[i]+a[j]-k):
     ind+=1
 print(m,ind)


for i in range(int(input())):
 n,k=list(map(int,input().split()))
 a=list(map(int,input().split()))
 m=10**10
 ind=1
 for i in range(n):
  for j in range(i+1,n):
   if abs(m)>abs(a[i]+a[j]-k):
    m=abs(a[i]+a[j]-k)
    ind=1
   elif abs(m)==abs(a[i]+a[j]-k):
    ind+=1
 print(m,ind)


# cook your dish here
for _ in range(int(input())):
 n,k=map(int,input().split())
 list1=list(map(int,input().split()))
 list1.sort()
 min1=1000000000000001
 maxsum=0
 for i in range(len(list1)):
  for j in range(i+1,len(list1)): 
   temp=abs(list1[i]+list1[j]-k) 
   if temp<min1:
    min1=min(min1,temp)
 if min1!=0:        
  cand1=k+min1
  cand2=k-min1

  s=list()
  cnt=0
  for i in list1:
   t1=cand1-i
   if t1 in s:
    cnt+=s.count(t1)
   t2=cand2-i
   if t2 in s:
    cnt+=s.count(t2)
   s.append(i) 
  print(min1,cnt) 
 else:
  cand=k+min1
  s=list()
  cnt=0
  for i in list1:
   t1=cand-i
   if t1 in s:
    cnt+=s.count(t1)
   s.append(i) 
  print(min1,cnt) 

for _ in range(int(input())):
 n,k=map(int,input().split())
 list1=list(map(int,input().split()))
 list1.sort()
 min1=1000000000000001
 maxsum=0
 for i in range(len(list1)):
  for j in range(i+1,len(list1)): 
   temp=abs(list1[i]+list1[j]-k) 
   if temp<min1:
    min1=min(min1,temp)
 if min1!=0:        
  cand1=k+min1
  cand2=k-min1

  s=list()
  cnt=0
  for i in list1:
   t1=cand1-i
   if t1 in s:
    cnt+=s.count(t1)
   t2=cand2-i
   if t2 in s:
    cnt+=s.count(t2)
   s.append(i) 
  print(min1,cnt) 
 else:
  cand=k+min1
  s=list()
  cnt=0
  for i in list1:
   t1=cand-i
   if t1 in s:
    cnt+=s.count(t1)
   s.append(i) 
  print(min1,cnt) 

for _ in range(int(input())):
 n,k=map(int,input().split())
 list1=list(map(int,input().split()))
 list1.sort()
 min1=1000000000000001
 maxsum=0
 for i in range(len(list1)):
  for j in range(i+1,len(list1)): 
   temp=abs(list1[i]+list1[j]-k) 
   if temp<min1:
    min1=min(min1,temp)
   else:
    break
 if min1!=0:        
  cand1=k+min1
  cand2=k-min1

  s=list()
  cnt=0
  for i in list1:
   t1=cand1-i
   if t1 in s:
    cnt+=s.count(t1)
   t2=cand2-i
   if t2 in s:
    cnt+=s.count(t2)
   s.append(i) 
  print(min1,cnt) 
 else:
  cand=k+min1
  s=list()
  cnt=0
  for i in list1:
   t1=cand-i
   if t1 in s:
    cnt+=s.count(t1)
   s.append(i) 
  print(min1,cnt) 

for _ in range(int(input())):
 n,k=map(int,input().split())
 list1=list(map(int,input().split()))
 list1.sort()
 min1=100000000001
 maxsum=0
 for i in range(len(list1)):
  for j in range(i+1,len(list1)): 
   temp=abs(list1[i]+list1[j]-k)
   
   if temp<min1:
    min1=min(min1,temp)
    maxsum=list1[i]+list1[j]
   else:
    break
  if list1[i]+list1[0]>k:
   break
 if min1!=0:        
  cand1=k+min1
  cand2=k-min1

  s=list()
  cnt=0
  for i in list1:
   t1=cand1-i
   if t1 in s:
    cnt+=s.count(t1)
   t2=cand2-i
   if t2 in s:
    cnt+=s.count(t2)
   s.append(i) 
  print(min1,cnt) 
 else:
  cand=k+min1
  s=list()
  cnt=0
  for i in list1:
   t1=cand-i
   if t1 in s:
    cnt+=s.count(t1)
   s.append(i) 
  print(min1,cnt) 

for _ in range(int(input())):
 N,K=map(int,input().split())
 A=list(map(int,input().split()))
 m=abs(A[0]+A[1]-K)
 c=0
 for i in range(N-1):
  for j in range(i+1,N):
   m=min(abs(A[i]+A[j]-K),m)
 for i in range(N-1):
  for j in range(i+1,N):
   if abs(A[i]+A[j]-K)==m:
    c+=1
 print(m,c)

for _ in range(int(input())):
 N, K = map(int, input().split())
 array = list(map(int, input().split()))
 count = 0
 mn = float('inf')
 for i in range(N):
  for j in range(i+1,N):
   if abs(array[i] + array[j] - K) < mn:
    mn = abs(array[i] + array[j] - K)
    count = 1
   elif abs(array[i] + array[j] - K) == mn:
    count+=1
 print(mn, count)

for _ in range(int(input())):
 N, K = map(int, input().split())
 array = list(map(int, input().split()))
 count = 0
 mn = float('inf')
 for i in range(N):
  for j in range(i+1,N):
   if abs(array[i] + array[j] - K) < mn:
    mn = abs(array[i] + array[j] - K)
    count = 1
   elif abs(array[i] + array[j] - K) == mn:
    count+=1
 print(mn, count)

for _ in range(int(input())):
 N, K = map(int, input().split())
 array = list(map(int, input().split()))
 count = 0
 mn = float('inf')
 for i in range(N):
  for j in range(i+1,N):
   if abs(array[i] + array[j] - K) < mn:
    mn = abs(array[i] + array[j] - K)
    count = 1
   elif abs(array[i] + array[j] - K) == mn:
    count+=1
 print(mn, count)

t = int(input())
for _ in range(t):
 n, k = [int(i) for i in input().split()]
 arr = [int(i) for i in input().split()]
 list_diff = []
 for i in range(n):
  for j in range(i+1, n):
   list_diff.append(abs(arr[i]+arr[j]-k))
 m = min(list_diff)
 ans = list_diff.count(m)
 print(m, end=" ")
 print(ans)