#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, m, a[N], b[N], mul = 1;
int ab(int x) {
  if (x < 0) return 0 - x;
  return x;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (n > m) {
    puts("0");
    return 0;
  }
  for (int i = 1; i <= n; i++)
    for (int j = (i + 1); j <= n; j++) {
      mul *= (ab(a[i] - a[j]) % m);
      mul %= m;
    }
  printf("%d\n", mul);
  return 0;
}
