#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0, w = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
  return s * w;
}
void put1() { puts("Yes"); }
void put2() { puts("No"); }
void debug() { printf("T   A   T\n"); }
void put3() { puts("-1"); }
long long qpf(long long a, long long b, long long p) {
  long long ret = 0;
  while (b) {
    if (b & 1) ret = (ret + a) % p;
    a = (a + a) % p;
    b >>= 1;
  }
  return ret % p;
}
long long qp(long long a, long long n, long long p) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = qpf(ret, a, p);
    a = qpf(a, a, p);
    n >>= 1;
  }
  return ret % p;
}
const int manx = 2e5 + 5;
long long b[manx];
int main() {
  long long n = read(), m = read(), ans = 1;
  for (int i = 1; i <= n; ++i) b[i] = read();
  if (n > 1000) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) ans = (ans * abs(b[i] - b[j])) % m;
  cout << ans % m << endl;
  return 0;
}
