#include <bits/stdc++.h>
using namespace std;
const int Z = (int)1e3 + 228;
const int N = (int)1e5 + 228;
const int INF = (int)1e9 + 228;
const int MOD = (int)1e9 + 7;
const long long LLINF = (long long)1e18 + 228;
const long double eps = (long double)1e-6;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  int ans = 1;
  vector<int> a(n), cnt(m);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cnt[a[i] % m]++;
    if (cnt[a[i] % m] == 2) {
      cout << 0;
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      ans = (1LL * ans * (abs(a[i] - a[j]))) % m;
    }
  }
  cout << ans;
  return 0;
}
