#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
long long cnt[2];
void dfs(int node, int pnode, int color) {
  cnt[color]++;
  for (int i = 0; i < v[node].size(); i++) {
    if (v[node][i] != pnode) dfs(v[node][i], node, !color);
  }
}
int mains() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    for (int i = 0; i < n; i++) cout << a[i] << " ";
    cout << endl;
    for (int i = 0; i < n; i++) cout << b[i] << " ";
    cout << endl;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  int m;
  cin >> m;
  if (n > m) {
    cout << "0";
  } else {
    vector<int> a;
    for (int i = 0; i < n; ++i) {
      int m;
      cin >> m;
      a.push_back(m);
    }
    long long int res = 1;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < i; ++j) {
        res *= abs(a[i] - a[j]);
        res %= m;
      }
    }
    cout << res;
  }
  return 0;
}
