#include <bits/stdc++.h>
using namespace std;
long long int arr[200005];
int main() {
  long long int n, m;
  scanf("%lld", &(n));
  scanf("%lld", &(m));
  for (long long int i = 0; i < n; i++) scanf("%lld", &(arr[i]));
  if (n > m) {
    cout << 0 << endl;
    return 0;
  }
  long long int res = 1;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i + 1; j < n; j++) {
      long long int x = fabs(arr[i] - arr[j]);
      res = (res * x) % m;
    }
  }
  printf("%lld\n", res);
}
