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