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 javax.swing.*;
import java.io.*;
import java.util.*;


public class Main {
    static PrintWriter out=new PrintWriter(System.out);

    public static void main(String[] args) throws IOException {
        //BufferedReader reader=new BufferedReader(new FileReader("input.txt"));
        //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //Scanner scanner=new Scanner(System.in);
        Reader in = new Reader();

        int t=in.nextInt();
        for (int i = 0; i <t ; i++) {
            int n=in.nextInt();
            int x=in.nextInt();
            int[] a=new int[n];
            for (int j = 0; j <n ; j++) {
                a[j]=in.nextInt();
            }
            int l=-1,r=-1,sum=0;
            for (int j = 0; j <n ; j++) {
                sum+=a[j];
                if (sum%x!=0)
                    l=Math.max(l,j+1);
            }
            sum=0;
            for (int j = n-1; j >=0 ; j--) {
                sum+=a[j];
                if (sum%x!=0)
                    r=Math.max(r,n-j);
            }
            System.out.println(Math.max(l,r));

        }























        out.close();

    }
    static int kadens(int[] a,int x){
        int maxSoFar=0;
        int maxEndHere=0;
        int count=0;
        boolean found=false;
        for (int i = 0; i <a.length ; i++) {
            maxEndHere+=a[i];
            count++;
            if (maxEndHere%x==0){
                maxEndHere=a[i];
                count=1;
            }
            else
                found=true;

            if (maxSoFar<count)
                maxSoFar=count;
        }
        if (found)
            return maxSoFar;
        else
            return -1;
    }
    static int gcd(int a,int b){
        if (b==0)
            return a;
        return gcd(b,a%b);

    }
    static boolean ok(int n){
        if (n%2==0 || n%3==0 || n%5==0)
            return true;
        else
            return false;
    }




    static int find(int n,int[] p){
        if (p[n]==n)return n;
        return p[n]=find(p[n],p);
    }
    static void union(int a,int b,int[] p){
        int aRoot=find(a,p);
        int bRoot=find(b,p);
        if (aRoot==bRoot)return;
        p[bRoot]=aRoot;
        //level[aRoot]+=level[bRoot];
    }
}
class node implements Comparable<node>{
    Integer no;
    Integer cost;
    Vector<node> adj=new Vector<>();
    public node(Integer no, Integer cost) {
        this.no = no;
        this.cost = cost;
    }

    @Override
    public String toString() {
        return "node{" +
                "no=" + no +
                ", cost=" + cost +
                '}';
    }

    @Override
    public int compareTo(node o) {
        return o.cost-this.cost;
    }
}
class edge implements Comparable<edge>{
    tuple u;
    Double cost;
    public edge(tuple u, Double cost) {
        this.u = u;
        this.cost = cost;
    }
    @Override
    public int compareTo(edge o) {
        return this.cost.compareTo(o.cost);
    }

    @Override
    public String toString() {
        return "edge{" +
                "u=" + u +
                ", cost=" + cost +
                '}';
    }
}
///*
class tuple implements Comparable<tuple>{
    int a;
    int b;
    tuple(int a, int b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public int compareTo(tuple o) {
        return (this.a-o.a);
    }

    @Override
    public String toString() {
        return "tuple{" +
                "a=" + a +
                ", b=" + b +
                '}';
    }
}

//*/
class Reader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException {
        byte[] buf = new byte[64];
        int cnt = 0, c;
        while ((c = read()) != -1) {
            if (c == '\n') break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException {
        int ret = 0;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (neg) return -ret;
        return ret;
    }

    public long nextLong() throws IOException {
        long ret = 0;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (neg) return -ret;
        return ret;
    }

    public double nextDouble() throws IOException {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
        if (neg) return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1) buffer[0] = -1;
    }

    private byte read() throws IOException {
        if (bufferPointer == bytesRead) fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException {
        if (din == null) return;
        din.close();
    }
}