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