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:
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

import java.util.*;

public class codeforces {
    public static InputReader in= new InputReader(System.in);
    public static PrintWriter out = new PrintWriter(System.out);
    public static int MAX_PRIME = 10000005;
    public static long []prime = new long[MAX_PRIME];
    public static int []cnt = new int[MAX_PRIME];
    public static void main(String[] args) {

        int t = in.nextInt();
        while (t-->0)
        {
            int n = in.nextInt();
            int []a = new int[n];
            HashMap<Integer, Integer> hm = new HashMap<>();
            for (int i = 0 ;i < n ; i++)
            {
                int x = in.nextInt();
                if (!hm.containsKey(x))
                {
                    hm.put(x,1);
                }
            }
            out.println(hm.size());
        }
        out.close();
    }



    public static long[] prime(){
        boolean []isprime = new boolean[MAX_PRIME];
        Arrays.fill(isprime, true);
        long []prime = new long[MAX_PRIME];
        for (int i = 2 ; i< MAX_PRIME ; i++){
            if (isprime[i]) {
                for (int j = i; j < MAX_PRIME; j += i) {
                    isprime[j] = false;
                    prime[i] = prime[i] + cnt[j];
                }
            }
        }

        return prime;

    }
    public static boolean []visit = new boolean[1000001];
    public static int []maxdis = new int[1000001];
    static void mergesort(int []arr, int left ,int right)
    {
        if(right>left)
        {
            int mid = (right+left)/2;
            mergesort(arr,left,mid);
            mergesort(arr,mid+1,right);
            MERGE(arr,left,mid,right);
        }

    }
    static void MERGE(int []arr,int left,int mid,int right)
    {
        int n1 = mid - left + 1;
        int n2 = right - mid;
        int []templ = new int[n1];
        int []tempr = new int[n2];

        for(int i = 0 ;i<n1 ;i++)
        {
            templ[i] = arr[left + i];
        }
        for (int i = 0 ; i<n2 ; i++)
        {
            tempr[i] = arr[mid + 1 +i];
        }

        int i = 0;
        int j = 0;
        int k = 1;
        while (i<n1 && j<n2)
        {
            if(templ[i]<=tempr[j])
            {
                arr[k] = templ[i];
                i++;
            }
            else
            {
                arr[k] = tempr[j];
                j++;
            }
            k++;
        }

        while (i<n1)
        {
            arr[k] = templ[i];
            i++;
            k++;
        }

        while(j<n2)
        {
            arr[k] = tempr[j];
            j++;
            k++;
        }
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}