#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> arr(n);
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  if (n > m) {
    cout << 0;
    return 0;
  } else {
    int ans = 1;
    for (int i = 0; i < n - 1; ++i) {
      for (int j = i + 1; j < n; ++j) {
        ans *= abs(arr[i] - arr[j]) % m;
        ans %= m;
      }
    }
    cout << ans;
    return 0;
  }
}
