#include <bits/stdc++.h>
using namespace std;
int n, m, a[200005], ans = 1;
set<int> S;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (S.count(a[i] % m)) {
      printf("0");
      return 0;
    }
    S.insert(a[i] % m);
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) ans = ans * (abs(a[i] - a[j]) % m) % m;
  printf("%d", ans);
  return 0;
}
