#include <bits/stdc++.h>
using namespace std;
vector<int> ANS;
struct node {
  node *prev, *next;
  int val;
  int cnt;
  node(int v = 0, int c = 0) {
    val = v;
    cnt = c;
    prev = next = NULL;
  }
};
struct linked_list {
  node *guard;
  node *f;
  linked_list() { guard = NULL; }
  void insert(int v, int c) {
    node *add = new node(v, c);
    if (guard == NULL) {
      f = guard = add;
      add->next = add->prev = add;
    } else {
      add->next = f;
      add->prev = guard;
      guard->next = add;
      guard = add;
    }
  }
  void close() {
    guard->next = f;
    f->prev = guard;
  }
};
void make(linked_list &list, map<int, int> &arr) {
  for (map<int, int>::iterator i = arr.begin(); i != arr.end(); ++i)
    list.insert(i->first, i->second);
  list.close();
}
const int MAXN = 1e5 + 100;
map<int, int> a, b;
node *er(node *p, bool x = false) {
  node *ret = p->next;
  if (x) ret = p->prev;
  p->next->prev = p->prev;
  p->prev->next = p->next;
  delete p;
  return ret;
}
int m;
int val(node *a, node *b) { return ((a->val) + (b->val)) % m; }
int main() {
  ios::sync_with_stdio(0);
  int n, X;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> X;
    a[X]++;
  }
  for (int i = 0; i < n; ++i) {
    cin >> X;
    b[X]++;
  }
  linked_list one, two;
  make(one, a);
  make(two, b);
  node *p1 = one.guard, *p2 = two.guard;
  while (n--) {
    while (1) {
      bool g = false;
      while (val(p1->prev, p2) > val(p1, p2)) {
        p1 = p1->prev;
        g = true;
      }
      while (val(p1->next, p2) > val(p1, p2)) {
        p1 = p1->next;
        g = true;
      }
      while (val(p1, p2->prev) > val(p1, p2)) {
        p2 = p2->prev;
        g = true;
      }
      while (val(p1, p2->next) > val(p1, p2)) {
        p2 = p2->next;
        g = true;
      }
      if (!g) break;
    }
    ANS.push_back(val(p1, p2));
    if (p1->cnt == 1)
      p1 = er(p1);
    else
      (p1->cnt)--;
    if (p2->cnt == 1)
      p2 = er(p2, 1);
    else
      (p2->cnt)--;
  }
  sort(ANS.begin(), ANS.end(), greater<int>());
  for (int i = 0; i < ANS.size(); ++i) cout << ANS[i] << " ";
  cout << endl;
  return 0;
}
