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