#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n;
  cin >> m;
  long long int sum = 1;
  long long int arr[n + 10];
  long long int coll[m + 67];
  memset(coll, 0, sizeof(coll));
  memset(arr, 0, sizeof(arr));
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    long long int temp = arr[i] % m;
    coll[temp]++;
    if (coll[temp] > 1) {
      cout << "0" << endl;
      return 0;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum = sum * abs(arr[i] - arr[j]);
      sum = sum % m;
    }
  }
  cout << sum % m << endl;
  return 0;
}
