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