#include <bits/stdc++.h>
using namespace std;
map<int, int> a, b;
vector<int> ans;
int next(int x, map<int, int> &m) {
  map<int, int>::iterator i = m.upper_bound(x);
  if (i == m.end()) i = m.begin();
  return i->first;
}
int prev(int x, map<int, int> &m) {
  map<int, int>::iterator i = m.lower_bound(x);
  if (i == m.begin()) i = m.end();
  i--;
  return i->first;
}
int main() {
  ios::sync_with_stdio(0);
  int n, m, tmp;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    a[tmp]++;
  }
  for (int j = 0; j < n; ++j) {
    cin >> tmp;
    b[tmp]++;
  }
  int ai = a.begin()->first, bi = b.begin()->first;
  while (n--) {
    while (1) {
      int aa = ai, bb = bi;
      while ((((ai) + (bi)) % m) < (((prev(ai, a)) + (bi)) % m))
        ai = prev(ai, a);
      while ((((ai) + (bi)) % m) < (((next(ai, a)) + (bi)) % m))
        ai = next(ai, a);
      while ((((ai) + (prev(bi, b))) % m) > (((ai) + (bi)) % m))
        bi = prev(bi, b);
      while ((((ai) + (next(bi, b))) % m) > (((ai) + (bi)) % m))
        bi = next(bi, b);
      if (aa == ai and bb == bi) break;
    }
    ans.push_back((((ai) + (bi)) % m));
    if (a[ai] > 1)
      a[ai]--;
    else {
      int cp = ai;
      ai = next(ai, a);
      a.erase(cp);
    }
    if (b[bi] > 1)
      b[bi]--;
    else {
      int cp = bi;
      bi = prev(bi, b);
      b.erase(cp);
    }
  }
  sort(ans.begin(), ans.end(), greater<int>());
  for (int i = 0; i < ans.size(); ++i) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
