#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 100 * 1000 + 20, M = 1000 + 20;
int n, m, a[N], cnt[M], ans = 1;
int sum(int a, int b) { return ((a + b) % m + m) % m; }
int mul(int a, int b) { return ((a * b) % m + m) % m; }
int pw(int a, int b) {
  int res = 1, tmp = a;
  while (b) {
    if (b & 1) res = mul(res, tmp);
    tmp = mul(tmp, tmp);
    b >>= 1;
  }
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n > m) return cout << 0 << "\n", 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) ans = mul(ans, (abs(a[i] - a[j]) % m + m) % m);
  return cout << ans << "\n", 0;
}
