#include <bits/stdc++.h>
using namespace std;
long long M = 1e9 + 7;
long long power(long long x, long long y) {
  if (y == 0) return 1;
  long long t = power(x, y / 2);
  t = ((t % M) * (t % M)) % M;
  if (y % 2 == 1) t = ((t % M) * (x % M)) % M;
  return t;
}
long long spf[100001];
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) {
  if (a > b) return b;
  return a;
}
long long bfs(vector<long long> v[], long long n) {
  long long i;
  n = 100;
  long long dis[100 + 1] = {0};
  long long flg[100 + 1] = {0};
  priority_queue<long long> q;
  q.push(1);
  dis[1] = 0;
  while (!q.empty()) {
    long long u = q.top();
    q.pop();
    flg[u] = 1;
    for (i = 0; i < v[u].size(); i++) {
      long long ve = v[u][i];
      if (flg[ve] == 0) {
        q.push(ve);
        dis[ve] = dis[u] + 1;
      }
    }
  }
  return dis[n];
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
long long isPrime(long long x) {
  vector<long long> v;
  long long i;
  for (i = 1; i * i <= x; i++) {
    if (x % i == 0) {
      if (i * i == x)
        v.push_back(i);
      else {
        v.push_back(i);
        v.push_back(x / i);
      }
    }
  }
  return v.size() == 2;
}
long long binary(vector<long long> a, long long x, long long l1, long long l2) {
  long long l = l1;
  long long r = l2;
  while (r - l > 1) {
    long long mid = (l + r) / 2;
    if (a[mid] < x)
      l = mid;
    else
      r = mid;
  }
  if (a[l] <= x && a[r] >= x)
    return l;
  else if (a[r] >= x)
    return r;
  else
    return l;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long phi(long long n) {
  long long result = n;
  for (long long p = 2; p * p <= n; ++p) {
    if (n % p == 0) {
      while (n % p == 0) n /= p;
      result -= result / p;
    }
  }
  if (n > 1) result -= result / n;
  return result;
}
void dfs(int source, int visited[], vector<int> graph[], int l) {
  visited[source] = l;
  int i;
  for (i = 0; i < graph[source].size(); i++) {
    if (visited[graph[source][i]] == -1)
      dfs(graph[source][i], visited, graph, l);
  }
}
int day(int d, int m, long long y) {
  static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
  y -= m < 3;
  return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7;
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
void output() {
  long long n, m;
  cin >> n >> m;
  long long a[n], i;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (i = 0; i < n; i++) a[i] = a[i] % m;
  int flg = 0;
  map<long long, long long> mp;
  for (i = 0; i < n; i++) {
    if (mp[a[i]] == 1) {
      cout << "0\n";
      return;
    }
    mp[a[i]] = 1;
  }
  long long j;
  long long prod = 1;
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      prod = ((prod % m) * ((a[j] % m - a[i] % m + m) % m) % m) % m;
    }
  }
  cout << prod << endl;
}
int main(int argc, const char *argv[]) {
  long long t;
  t = 1;
  while (t--) {
    output();
  }
  return 0;
}
