#include <bits/stdc++.h>
using namespace std;
int read() {
  int res = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') f = -1, c = getchar();
  while (isdigit(c)) res = (res << 3) + (res << 1) + (c ^ 48), c = getchar();
  return res * f;
}
const int maxn = 2e5 + 10;
const int maxm = 1e3 + 10;
int n, m, a[maxn], tmp[maxm], ct[maxm];
int qpow(int x, int p) {
  int res = 1;
  for (; p; x = (x * x) % m, p >>= 1)
    if (p & 1) res = (res * x) % m;
  return res;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  if (n > m) {
    printf("0\n");
    return 0;
  }
  long long ans = 1;
  for (int i = 1; i < n; i++)
    for (int j = i + 1; j <= n; j++) ans = (ans * abs(a[i] - a[j])) % m;
  printf("%I64d\n", ans);
  return 0;
}
