#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(NULL);
  std::cout.tie(NULL);
  unsigned long long int n, m;
  cin >> n >> m;
  vector<unsigned long long int> a(n);
  for (unsigned long long int i = 0; i < n; i++) cin >> a[i];
  if (n > m)
    cout << 0 << endl;
  else {
    unsigned long long int res = 1;
    for (unsigned long long int i = 0; i < n; i++) {
      unsigned long long int p = 1;
      for (unsigned long long int j = 0; j < i; j++) {
        res *= llabs(a[i] - a[j]);
        res %= m;
      }
    }
    cout << res << endl;
  }
  return 0;
}
