#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9 + 9;
const long long inf = 1e18 + 18;
const int max6 = 1e6 + 6;
const int modx = 1e9 + 7;
const int mody = 997;
const int base = 137;
int n, m;
int cnt[max6], a[max6], tmp[max6];
int f[3][1005][1005];
int b[3][1005][1005];
int Pow(int a, int b) {
  if (b == 0) return 1;
  int half = Pow(a, b / 2);
  int res = 1ll * half * half % m;
  if (b % 2) res = 1ll * res * a % m;
  return res;
}
void update(int id, int j, int u) {
  if (id == 1) {
    for (; u > 0; u -= u & (-u)) b[id][j][u]++;
  } else {
    for (; u <= n; u += u & (-u)) b[id][j][u]++;
  }
}
int get(int id, int j, int u) {
  int res = 0;
  if (id == 1) {
    for (; u <= n; u += u & (-u)) res = res + b[id][j][u];
  } else {
    for (; u > 0; u -= u & (-u)) res = res + b[id][j][u];
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    int u = a[i] % m;
    if (cnt[u]) {
      cout << 0;
      return 0;
    }
    cnt[u]++;
  }
  int res = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) res = 1ll * res * abs(a[i] - a[j]) % m;
  cout << res;
}
