#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
template <class T>
void read(vector<T>& a) {
  for (int i = 0; i < a.size(); i++) cin >> a[i];
}
int main() {
  double TIME_START = clock();
  int n;
  cin >> n;
  vector<pair<int, int> > a(2 * n);
  for (int i = 0; i < 2 * n; ++i) {
    cin >> a[i].first;
    if (i < n) {
      a[i].second = i;
    } else {
      a[i].second = i - n;
    }
  }
  int m;
  cin >> m;
  sort(a.begin(), a.end());
  vector<int> d(2 * n - 1, 1);
  long long cur = 1;
  long long twos = 0;
  for (int i = 1; i < 2 * n; ++i) {
    if (a[i].first == a[i - 1].first) {
      ++cur;
      d[i - 1] = cur;
    } else {
      cur = 1;
    }
    if (a[i] == a[i - 1]) {
      ++twos;
    }
  }
  long long ans = 1;
  for (int i = 0; i < 2 * n - 1; i++) {
    while (twos && d[i] % 2 == 0) {
      d[i] /= 2;
      --twos;
    }
    ans = (ans * d[i]) % m;
  }
  cout << ans % m;
  return 0;
}
