#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool prime[1000005];
void seive(int n) {
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<long long> a(n), b(n);
    for (long long i = 0; i < n; i++) cin >> b[i], a[i] = b[i] % m;
    long long cnt = 1;
    if (n > m)
      cout << 0 << endl;
    else {
      map<long long, long long> fre;
      for (long long i = 0; i < n; i++) fre[a[i]]++;
      bool flag = false;
      for (auto x : fre) {
        if (x.second > 1) {
          flag = true;
          break;
        }
      }
      if (flag)
        cout << 0 << endl;
      else {
        for (long long i = 0; i < n; i++) {
          for (long long j = i + 1; j < n; j++) {
            cnt = (cnt % m * abs(b[j] - b[i]) % m) % m;
            if (!cnt) break;
          }
          if (!cnt) break;
        }
        cout << cnt % m << endl;
      }
    }
  }
  return 0;
}
