#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9) + 7;
int main() {
  ios::sync_with_stdio(false);
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (n >= 1001) {
    cout << 0;
    return 0;
  }
  long long res = 1;
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) res = (res * (abs(a[i] - a[j]))) % m;
  cout << res;
  return 0;
}
