Problem: Ehab loves number theory, but for some reason he hates the number x. Given an array a, find the length of its longest subarray such that the sum of its elements isn't divisible by x, or determine that such subarray doesn't exist.

An array a is a subarray of an array b if a can be obtained from b by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end.

Input

The first line contains an integer t (1 ≤ t ≤ 5) — the number of test cases you need to solve. The description of the test cases follows.

The first line of each test case contains 2 integers n and x (1 ≤ n ≤ 10^5, 1 ≤ x ≤ 10^4) — the number of elements in the array a and the number that Ehab hates.

The second line contains n space-separated integers a_1, a_2, …, a_{n} (0 ≤ a_i ≤ 10^4) — the elements of the array a.

Output

For each testcase, print the length of the longest subarray whose sum isn't divisible by x. If there's no such subarray, print -1.

Example

Input


3
3 3
1 2 3
3 4
1 2 3
2 2
0 6


Output


2
3
-1

Note

In the first test case, the subarray [2,3] has sum of elements 5, which isn't divisible by 3.

In the second test case, the sum of elements of the whole array is 6, which isn't divisible by 4.

In the third test case, all subarrays have an even sum, so the answer is -1.

Solution (in JAVA):

Solution:
//package src;

import java.util.Scanner;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.StringBuilder;
import java.math.BigInteger;

public class idk {
	static Scanner scn = new Scanner(System.in);
	static int mod = 1000000007;

	public static void main(String[] args) {
		int t=scn.nextInt();
		while(t-->0)
		{
			int n=scn.nextInt(),x=scn.nextInt();
			int arr[]=new int[n],sum=0,tot=0;		
			for(int i=0;i<n;i++)
			{
				arr[i]=scn.nextInt();
				sum+=arr[i];
			}
			tot=sum;
			if(sum%x!=0)
				System.out.println(n);
			else
			{	int l=n-1,ans1=-1,ans2=-1,s=0;
				for(int i=0;i<n;i++)
				{	sum-=arr[i];
					if((sum)%x!=0)
					{
						ans1=l-i;
						break;
					}
				}
				sum=tot;
				for(int i=n-1;i>=0;i--)
				{	sum-=arr[i];
					if((sum)%x!=0)
					{
						ans2=i-s;
						break;
					}
				}
				if(ans1==-1&&ans2==-1)
				{
					System.out.println("-1");
				}
				else
					System.out.println(Math.max(ans1,ans2));
			}
			
		}
	}

	public static int decode(String str, int i,int []memo) {
		if (i == 0) {
			return 1;
		}
		int ind = str.length() - i;
		if (str.charAt(ind) == '0')
			return 0;
		if(memo[i]!=-1)
			return memo[i];
		int res = decode(str, i - 1,memo);
		if (i >= 2 && Integer.parseInt(str.substring(ind, ind + 2)) <= 26) {
			res += decode(str, i - 2,memo);
		}
		memo[i]=res;
		return res;
	}

	public static String binary(long n) {
		StringBuilder sb = new StringBuilder();
		while (n != 0) {
			sb.append(n % 2);
			n /= 2;
		}
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long a, long b) {
		if (a == 0)
			return b;
		return gcd(b % a, a);
	}

	public static String factorial(int n) {
		BigInteger fac = new BigInteger("1");
		for (int i = 1; i <= n; i++) {
			fac = fac.multiply(BigInteger.valueOf(i));
		}
		return fac.toString();
	}

}

class pair {
	int a;
	int b;
	int c;

	pair(int x, int y, int z) {
		this.a = x;
		this.b = y;
		this.c = z;
	}
}

class sorting implements Comparator<pair> {

	@Override
	public int compare(pair o1, pair o2) {
		// TODO Auto-generated method stub
		int dif = o1.b - o2.b, str = o1.a - o2.a;
		if (dif == 0) {
			if (str < 0)
				return -1;
			else
				return 1;

		} else if (dif < 0) {
			return -1;
		} else
			return 1;
	}

}