#include <bits/stdc++.h>
using namespace std;
int cnt[100005];
int main() {
  int n, m, x;
  scanf("%d%d", &n, &m);
  map<int, int> a, b;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    b[x]++;
  }
  priority_queue<pair<int, int> > q;
  for (int i = m - 1; ~i; i--) {
    auto me = b.find(i);
    if (me == b.end()) continue;
    auto it = a.lower_bound(m - i);
    if (it == a.begin())
      it = --a.end();
    else
      --it;
    q.push(pair<int, int>((me->first + it->first) % m, me->first));
  }
  map<int, int>::iterator by;
  while (q.size()) {
    int sum = q.top().first;
    auto me = b.find(q.top().second);
    auto it = a.find((sum - q.top().second + m) % m);
    q.pop();
    if (me == b.end()) continue;
    if (it == a.end()) {
      it = a.lower_bound(m - me->first);
      if (it == a.begin())
        it = --a.end();
      else
        --it;
      q.push(pair<int, int>((me->first + it->first) % m, me->first));
    } else {
      int use = min(me->second, it->second), old = me->second;
      cnt[sum] += use;
      if (me->second == use)
        b.erase(me);
      else
        me->second -= use;
      if (it->second == use)
        a.erase(it);
      else
        it->second -= use;
      if (old != use) {
        it = a.lower_bound(m - me->first);
        if (it == a.begin())
          it = --a.end();
        else
          --it;
        q.push(pair<int, int>((me->first + it->first) % m, me->first));
      }
    }
  }
  for (int i = m - 1; ~i; i--)
    while (cnt[i]--) printf("%d ", i);
}
