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