#include <bits/stdc++.h>
using namespace std;
long long ans[1005];
long long n, m;
int main() {
  scanf("%I64d%I64d", &n, &m);
  if (n > m)
    printf("0");
  else {
    for (long long i = 1; i <= n; i++) scanf("%I64d", &ans[i]);
    long long finalans = 1;
    for (long long i = 1; i < n; i++)
      for (long long j = i + 1; j <= n; j++) {
        finalans *= (abs(ans[i] - ans[j]) % m);
        finalans %= m;
      }
    printf("%I64d", finalans);
  }
  return 0;
}
