#include <bits/stdc++.h>
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m;
  cin >> n >> m;
  if (n > 1000) {
    cout << 0 << '\n';
    return 0;
  }
  vector<long long> ar(n);
  for (auto &i : ar) cin >> i;
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      ans *= abs(ar[i] - ar[j]) % m;
      ans %= m;
    }
  }
  cout << ans << '\n';
}
