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