#include <bits/stdc++.h>
using namespace std;
long long m, n, a, b, c, ans, ar[1000001], k, paths[200010], visit[200010],
    ans1, dp[400010], t, er[200110];
bool boo;
bool compare(long long a, long long b) {
  if (a >= b) return 1;
  return 0;
}
int main() {
  string s;
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    er[i] = a;
    a %= m;
    ar[a]++;
  }
  for (long long i = 0; i < m; i++) {
    if (ar[i] >= 2) {
      cout << 0;
      return 0;
    }
  }
  ans = 1;
  sort(er, er + n);
  for (long long i = n - 1; i >= 0; i--) {
    for (long long j = 0; j < i; j++) {
      ans *= (er[i] - er[j]) % m;
      ans %= m;
    }
  }
  cout << ans % m;
}
