#include <bits/stdc++.h>
using namespace std;
int cnt1[100010];
map<int, int>::iterator fnd(int m, int x, map<int, int> &mp) {
  int y = m - 1 - x;
  if (y < 0) y += m;
  map<int, int>::iterator i = mp.upper_bound(y);
  if (i == mp.begin()) i = mp.end();
  --i;
  return i;
}
int main() {
  ios::sync_with_stdio(0);
  int n, m, d;
  cin >> n >> m;
  map<int, int> cnt2;
  map<int, int>::iterator I;
  for (int i = 0; i < n; ++i) {
    cin >> d;
    ++cnt1[d];
  }
  for (int i = 0; i < n; ++i) {
    cin >> d;
    ++cnt2[d];
  }
  priority_queue<pair<int, int> > pq;
  for (int i = 0; i < m; ++i)
    if (cnt1[i]) {
      I = fnd(m, i, cnt2);
      int s = i + I->first;
      if (s >= m) s -= m;
      pq.push(make_pair(s, i));
    }
  vector<int> ans;
  ans.reserve(n);
  while (!pq.empty() && !cnt2.empty()) {
    pair<int, int> p = pq.top();
    pq.pop();
    int s = p.first;
    int t = p.second;
    int u = s - t;
    if (u < 0) u += m;
    I = cnt2.find(u);
    if (I == cnt2.end()) {
      I = fnd(m, t, cnt2);
      s = t + I->first;
      if (s >= m) s -= m;
      pq.push(make_pair(s, t));
    } else {
      ans.push_back(s);
      int k = --I->second;
      if (!k) {
        cnt2.erase(I);
      }
      if (--cnt1[t]) {
        if (!k) I = fnd(m, t, cnt2);
        s = t + I->first;
        if (s >= m) s -= m;
        pq.push(make_pair(s, t));
      }
    }
  }
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  return 0;
}
