#include <bits/stdc++.h>
using namespace std;
bool compare(long long int a, long long int b) { return a <= b ? 0 : 1; }
signed main() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n > m) {
    cout << 0 << endl;
  } else {
    long long int ans = 1;
    for (long long int i = 0; i < n - 1; i++) {
      for (long long int j = i + 1; j < n; j++) {
        long long int x = abs(a[i] - a[j]);
        ans = (ans * x % m) % m;
      }
    }
    cout << ans << endl;
  }
}
