#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long INF = (1 << 30) - 1;
const long long LLINF = (1LL << 60LL);
const long long MOD = 1000000007;
const long long mod = 998244353;
const long long MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
long long dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
struct Timer {
  chrono::system_clock::time_point start, end;
  Timer() { start = chrono::system_clock::now(); }
  ~Timer() {
    end = chrono::system_clock::now();
    auto msec =
        chrono::duration_cast<chrono::milliseconds>(end - start).count();
    cerr << "time : " << msec << " ms" << endl;
  }
};
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[200010];
  vector<long long> x(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    x[i] = a[i] % m;
  }
  sort(x.begin(), x.end());
  x.erase(unique(x.begin(), x.end()), x.end());
  long long N = x.size();
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    mp[a[i] % m]++;
  }
  long long ans = 1;
  if (N < n) {
    cout << 0 << endl;
    return;
  }
  for (long long i = 0; i < N; i++) {
    for (long long j = i + 1; j < N; j++) {
      ans *= abs(a[i] - a[j]) % m;
      ans %= m;
    }
  }
  cout << ans << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  long long q;
  q = 1;
  for (long long _ = 0; _ < q; _++) {
    solve();
  }
  return 0;
}
