#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m;
int a[N];
long long cnt[N];
long long mod_pow(long long a, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * a % m;
    a = a * a % m;
    k /= 2;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  if (n > m + 1000) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      ans = (ans * abs(a[i] - a[j])) % m;
    }
  }
  cout << ans << endl;
  return 0;
}
