#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, t, k, sum, max, sum1, m;
  t = 1;
  string s, s1;
  vector<int> v, v1;
  cin >> n >> m;
  sum = 1;
  for (i = 0; i < n; i++) {
    cin >> j;
    v.push_back(j);
  }
  if (n > m) {
    cout << "0" << endl;
    return 0;
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      sum = (sum * abs(v[i] - v[j])) % m;
    }
  }
  sum = sum % m;
  cout << sum << endl;
}
