#include <bits/stdc++.h>
using namespace std;
const long long maxn = 200000 + 10;
long long n, a[maxn], m;
int main() {
  cin >> n >> m;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long ans = 1;
  if (n > m)
    printf("0\n");
  else {
    for (long long i = 1; i <= n; i++) {
      for (long long j = i + 1; j <= n; j++) {
        ans = (ans * (abs(a[j] - a[i]) % m)) % m;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
