#include <bits/stdc++.h>
using namespace std;
const long long INF = 2000000000000000000;
long double eps = 1e-12;
long long t, n, m, a;
vector<long long> vec;
void Stefan() {
  cin >> n >> m;
  long long cur = 1;
  for (int i = 0; i < n; i++) {
    cin >> a;
    vec.push_back(a);
  }
  if (n > m) {
    cout << 0;
    return;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      cur *= abs(vec[i] - vec[j]);
      cur %= m;
      if (!cur) {
        cout << 0;
        return;
      }
    }
  }
  cout << cur;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  t = 1;
  while (t) {
    Stefan();
    t--;
  }
}
