#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m, ans;
  cin >> n >> m;
  vector<long long> ar(n);
  for (long long i = 0; i < n; i++) cin >> ar[i];
  sort(ar.begin(), ar.end());
  ans = 1;
  if (n > m) {
    cout << 0;
    return;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j < n; j++) {
      ans = (ans % m * abs(ar[i] - ar[j]) % m) % m;
      if (ans == 0) {
        cout << 0;
        return;
      }
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q = 1;
  while (q--) {
    solve();
  }
  return 0;
}
