#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m, ans = 1, val, flag = 0;
  cin >> n >> m;
  vector<long long> v;
  map<long long, long long> mpp;
  for (long long i = 0; i < n; i++) {
    cin >> val;
    mpp[val % m]++;
    v.push_back(val);
  }
  for (auto& i : mpp) {
    if (i.second >= 2) {
      flag = 1;
      break;
    }
  }
  if (flag) {
    cout << 0 << "\n";
    return 0;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j <= n - 1; j++) {
      val = abs(v[i] - v[j]);
      val %= m;
      ans *= val;
      ans %= m;
    }
  }
  cout << ans;
}
