#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, ans = 1;
  cin >> n >> m;
  vector<long long int> v(n), vt(n);
  for (long long int i = 0; i <= n - 1; i++) cin >> vt[i], v[i] = vt[i] % m;
  if (n > m) {
    cout << 0;
    return 0;
  }
  set<long long int> s((v).begin(), (v).end());
  if (s.size() < n) {
    cout << 0;
    return 0;
  }
  for (long long int i = 0; i <= n - 2; i++) {
    for (long long int j = i + 1; j <= n - 1; j++) {
      ans = (ans * (abs(vt[j] - vt[i]) % m)) % m;
    }
  }
  cout << ans;
}
