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