To become the king of Codeforces, Kuroni has to solve the following problem.

He is given n numbers a_1, a_2, ..., a_n. Help Kuroni to calculate ∏_{1≤ i<j≤ n} |a_i - a_j|. As result can be very big, output it modulo m.

If you are not familiar with short notation, ∏_{1≤ i<j≤ n} |a_i - a_j| is equal to |a_1 - a_2|⋅|a_1 - a_3|⋅ ... ⋅|a_1 - a_n|⋅|a_2 - a_3|⋅|a_2 - a_4|⋅ ... ⋅|a_2 - a_n| ⋅ ... ⋅ |a_{n-1} - a_n|. In other words, this is the product of |a_i - a_j| for all 1≤ i < j ≤ n.

Input

The first line contains two integers n, m (2≤ n ≤ 2⋅ 10^5, 1≤ m ≤ 1000) — number of numbers and modulo.

The second line contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^9).

Output

Output the single number — ∏_{1≤ i<j≤ n} |a_i - a_j| mod m.

Examples

Input


2 10
8 5


Output


3

Input


3 12
1 4 5


Output


0

Input


3 7
1 4 9


Output


1

Note

In the first sample, |8 - 5| = 3 ≡ 3 mod 10.

In the second sample, |1 - 4|⋅|1 - 5|⋅|4 - 5| = 3⋅ 4 ⋅ 1 = 12 ≡ 0 mod 12.

In the third sample, |1 - 4|⋅|1 - 9|⋅|4 - 9| = 3 ⋅ 8 ⋅ 5 = 120 ≡ 1 mod 7.
import java.util.*;
import java.io.*;
import java.math.BigInteger;
public class cf1 {
    static long mod = (long) Math.pow(10, 9) + 7;
    static FastScanner f = new FastScanner(System.in);
    static Scanner S = new Scanner(System.in);
    public static void main(String[] args)throws IOException {
        int n = f.nextInt();
        int m = f.nextInt();
        int arr[] = inpint(n);
        for(Integer i : arr)
            i %= m;
        int flag = 0;
        HashSet<Integer> h = new HashSet<Integer>();
        for(Integer i : arr) {
            if(!h.contains(i))
                h.add(i);
            else {
                flag = 1;
                break;
            }
        }
        if(flag == 0) {
            int ans = 1;
            ArrayList<Integer> temp = new ArrayList<Integer>();
            for(Integer i : h) {
                temp.add(i);
            }
            for(int i = 0; i < temp.size(); i++) {
                int t1 = temp.get(i);
                for(int j = i + 1; j < temp.size(); j++) {
                    ans = ((ans % m) * (Math.abs(t1 - temp.get(j)) % m)) % m;
                    if(ans == 0)
                        break;  
                }
                if(ans == 0)
                    break;
            }
            pn(ans);
        }
        else
            pn(0);
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    // Fast Scanner Alternative of Scanner 
    // Uses Implementation of BufferedReader Class
    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new
                    InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        String nextLine()throws IOException {
            return br.readLine();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
    
    // Print in console
    static void pn(Object o){System.out.println(o);}
    static void p(Object o){System.out.print(o);}
    static void pni(Object o){System.out.println(o);System.out.flush();}

    // Pair class in java
    static class Point implements Comparator<Point>{
        int x;int y;
        Point(int x,int y) {
            this.x=x;
            this.y=y;
        }
        Point(){}
        public int compare(Point a, Point b){
            if (a.x == b.x) 
                return a.y - b.y;
            return a.x - b.x;
        }
    }

    //GCD of two integers
    static int gcd(int a, int b) {
        if(b == 0) return a;
        else {
            return gcd(b, a % b);
        }
    }
    // Input int array
    static int[] inpint(int n) {
        int arr[] = new int[n];
        for(int i = 0; i < n; i++) 
            arr[i] = f.nextInt();
        return arr;
    }

    //Input long array
    static long[] inplong(int n) {
        long arr[] = new long[n];
        for(int i = 0; i < n; i++) 
            arr[i] = f.nextLong();
        return arr;
    }

    // GCD of a array of integers
    static int gcdarray(int a[]) {
        int res = a[0];
        for(int i = 1; i < a.length; i++) {
            res = gcd(a[i] , res);
        }
        return res;
    }
    
    // Return boolean sieve of first n prime nos.
    static boolean[] sieve(int n) {
        boolean isprime[] = new boolean[n + 1];
        for(int i = 0; i <= n;++i) {
            isprime[i] = true;
        }
        isprime[0] = false;
        isprime[1] = false;
        for(int i = 2; i * i <= n; ++i) {
             if(isprime[i] == true) {               
                 for(int j = i * i; j <= n;j += i)
                     isprime[j] = false;
            }
        }
        return isprime;
    }

    // Return HashSet of factors of a number
    static HashSet<Long> factors(long n) {
        HashSet<Long> hs = new HashSet<Long>();
        for(long i = 1; i <= (long)Math.sqrt(n); i++) {
            if(n % i == 0) {
                hs.add(i);
                hs.add(n / i);
            }
        }
        return hs;
    }

    //Is n prime ?
    static boolean isPrime(int n) {
        if(n == 1) return false;
        int i = 2;
        while((i * i) <= n) {
            if(n % i == 0) return false;
            i += 1;
        }
        return true;
    }

    // Gives next (Lexicographical) permutation of String
    public static String nextPerm(String s) {
        StringBuffer sb = new StringBuffer(s);
        String res = "No Successor";
        int ii = -1 , jj = -1;
        for(int i = 0; i < s.length() - 1; i++) {
            if((int)s.charAt(i) < (int)s.charAt(i + 1))
                ii = i;
        }
        for(int j = ii + 1; j < s.length() && j != 0; j++) {
            if((int)s.charAt(j) > (int)s.charAt(ii))
                jj = j;
        }
        if(ii == -1)
            return res;
        else {
        char tempi = s.charAt(ii);
        char tempj = s.charAt(jj);
        sb.setCharAt(jj , tempi);
        sb.setCharAt(ii , tempj);
        StringBuffer sub = new StringBuffer(sb.substring(ii + 1));
        sub.reverse();
        int v = sub.length();
        while(v-- > 0) {
            sb.deleteCharAt(sb.length() - 1);
        }
        sb.append(sub);
        res = sb.toString();
        return res;
        }
    }
}