#include <bits/stdc++.h>
using namespace std;
int _;
const int MAXN = 100 * 1000;
int n, m;
int a[MAXN], b[MAXN];
int n1[MAXN], n2[MAXN];
pair<int, int> st[MAXN];
int len;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (__typeof(n) i = (0); i < (n); ++i) {
    cin >> a[i];
    ++n1[a[i]];
  }
  for (__typeof(n) i = (0); i < (n); ++i) {
    cin >> b[i];
    ++n2[b[i]];
  }
  vector<int> ans;
  for (__typeof(m) i = (0); i < (m); ++i) {
    for (__typeof(n1[i]) j = (0); j < (n1[i]); ++j)
      st[len++] = pair<int, int>(i, 1);
    int x = m - 1 - i;
    for (__typeof(n2[x]) j = (0); j < (n2[x]); ++j) {
      pair<int, int> p = st[len - 1];
      if (p.second == 1) {
        ans.push_back((p.first + x) % m);
        --len;
      } else
        st[len++] = pair<int, int>(x, 2);
    }
  }
  for (int i = 0; i < len / 2; ++i) {
    ans.push_back((st[i].first + st[len - i - 1].first) % m);
  }
  sort(ans.begin(), ans.end(), greater<int>());
  for (__typeof(n) i = (0); i < (n); ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
