#include <bits/stdc++.h>
using namespace std;
int cnt[1010] = {};
int a[300000];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  bool flag = false;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    cnt[a[i] % m]++;
    if (cnt[a[i] % m] >= 2) flag = true;
  }
  if (flag) {
    printf("0\n");
    return 0;
  }
  long long ans = 1;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) ans = (ans * abs(a[j] - a[i])) % m;
  printf("%lld\n", ans);
  return 0;
}
