#include <bits/stdc++.h>
using namespace std;
long long n, m;
long long a[1007], f[1007];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    if (f[a[i] % m]) {
      cout << 0 << endl;
      return 0;
    }
    f[a[i] % m]++;
  }
  long long ret = 1;
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      ret = ret * abs(a[i] - a[j]) % m;
    }
  }
  cout << ret << endl;
  return 0;
}
