#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, fl = 0, a[200005], c[200005] = {0}, ans, i, j;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    a[i] = a[i] % m;
    c[a[i]]++;
    if (c[a[i]] > 1) fl = 1;
  }
  if (fl == 1) cout << "0" << endl;
  if (fl == 0) {
    ans = 1;
    for (i = 0; i < n; i++) {
      for (j = i + 1; j < n; j++) {
        ans = (ans % m * ((a[j] - a[i] + m) % m)) % m;
      }
    }
    cout << ans << endl;
  }
}
