#include <bits/stdc++.h>
using namespace std;
template <class T = int>
inline T in() {
  T x;
  cin >> x;
  return x;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  for (auto& vi : vec) os << vi << " ";
  return os;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> cnt1(m), cnt2(m);
  for (int i = 0; i < n; i++) cnt1[in()]++;
  for (int i = 0; i < n; i++) cnt2[m - 1 - in()]++;
  vector<int> res, st1_dec, st2_inc;
  for (int i = m - 1; i >= 0; i--) {
    while (cnt1[i] && cnt2[i]) res.emplace_back(m - 1), cnt1[i]--, cnt2[i]--;
    while (cnt2[i]) st2_inc.emplace_back(m - 1 - i), cnt2[i]--;
    while (cnt1[i] && !st2_inc.empty()) {
      res.emplace_back(i + st2_inc.back()), st2_inc.pop_back(), cnt1[i]--;
    }
    while (cnt1[i]) st1_dec.emplace_back(i), cnt1[i]--;
  }
  reverse(begin(st2_inc), end(st2_inc));
  for (int i = 0; i < (int)st1_dec.size(); i++) {
    res.emplace_back((st1_dec[i] + st2_inc[i]) % m);
  }
  sort(res.rbegin(), res.rend());
  cout << res << endl;
  return 0;
}
