#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    a[i] = x;
  }
  if (n > m) {
    cout << 0;
  } else {
    long long int p = 1;
    for (long long int i = 0; i < n; i++) {
      for (long long int j = i + 1; j < n; j++) {
        p = p * (abs(a[i] - a[j]) % m);
        p = p % m;
      }
    }
    cout << p;
  }
  return 0;
}
