#include <bits/stdc++.h>
using namespace std;
const int maxn = 111111;
struct node {
  struct node *c[2], *fa;
  int id;
  int sz;
  int val;
  inline bool d() { return fa->c[0] == this; }
  inline void setc(int d, node *s) {
    c[d] = s;
    s->fa = this;
  }
  void up() { sz = c[0]->sz + c[1]->sz + 1; }
} NODE[2 * maxn], *null = &NODE[0];
int top;
struct SplayTree {
  int type;
  node *root;
  void Rotate(node *x, int f) {
    node *y = x->fa;
    y->setc(!f, x->c[f]);
    x->fa = y->fa;
    if (y->fa != null) y->fa->setc(!y->d(), x);
    x->setc(f, y);
    y->up();
  }
  void Splay(node *x, node *goal) {
    while (x->fa != goal) {
      if (x->fa->fa == goal)
        Rotate(x, x->d());
      else {
        int f = x->fa->d();
        x->d() == f ? Rotate(x->fa, f) : Rotate(x, !f);
        Rotate(x, f);
      }
    }
    x->up();
    if (goal == null) root = x;
  }
  void RTO(int k, node *goal) {
    node *x = root;
    while (x->c[0]->sz + 1 != k) {
      if (k < x->c[0]->sz + 1)
        x = x->c[0];
      else {
        k -= x->c[0]->sz + 1;
        x = x->c[1];
      }
    }
    Splay(x, goal);
  }
  node *new_node(node *fa, int v) {
    node *x = &NODE[++top];
    x->id = top;
    x->c[0] = x->c[1] = null;
    x->sz = 1;
    x->val = v;
    x->fa = fa;
    return x;
  }
  node *find_pre(node *x, int v, int dd) {
    if (x == null) return x;
    if (x->val == v) {
      return x;
    } else if (x->val < v) {
      node *tmp = find_pre(x->c[1], v, dd + 1);
      return tmp == null ? x : tmp;
    } else {
      return find_pre(x->c[0], v, dd + 1);
    }
  }
  void insert(node *&x, node *y) {
    if (x == null) {
      x = y;
      return;
    }
    if (y->val <= x->val) {
      insert(x->c[0], y);
      x->c[0]->fa = x;
    } else {
      insert(x->c[1], y);
      x->c[1]->fa = x;
    }
    x->up();
  }
  int Max() {
    RTO(root->sz, null);
    return root->val;
  }
  void insert(int v) {
    node *tmp = new_node(null, v);
    insert(root, tmp);
    Splay(tmp, null);
  }
  void Del_root() {
    node *t = root;
    if (t->c[1] != null) {
      root = t->c[1];
      RTO(1, null);
      root->c[0] = t->c[0];
      if (root->c[0] != null) root->c[0]->fa = root;
    } else
      root = root->c[0];
    root->fa = null;
    if (root != null) root->up();
  }
  node *find(node *x, int v) {
    if (x == null) return x;
    if (x->val == v)
      return x;
    else if (x->val < v)
      return find(x->c[1], v);
    else
      return find(x->c[0], v);
  }
  void del(int v) {
    node *tmp = find(root, v);
    Splay(tmp, null);
    Del_root();
  }
  int find_pre(int v) {
    node *tmp = find_pre(root, v, 0);
    if (tmp != null)
      Splay(tmp, null);
    else
      RTO(1, null);
    if (tmp->val == -1)
      return Max();
    else
      return tmp->val;
  }
  void vist(node *x) {
    if (x != null) {
      printf("节点：%2d ： 左儿子： %2d  右儿子：  %2d  sz: %2d val: %2d\n",
             x->id, x->c[0]->id, x->c[1]->id, x->sz, x->val);
      vist(x->c[0]);
      vist(x->c[1]);
    }
  }
  void debug() {
    puts("************");
    vist(root);
    puts("\n*****************");
  }
  void init() { root = new_node(null, -1); }
} spt[2];
void prepare() {
  top = 0;
  null->id = 0;
  null->c[0] = null->c[1] = null->fa = NULL;
  null->sz = null->val = 0;
}
int a[2][maxn];
int main() {
  prepare();
  spt[0].init();
  spt[1].init();
  int n, m, num;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &num);
      a[i][j] = num;
    }
  }
  for (int i = 0; i < 2; i++) random_shuffle(a[i], a[i] + n);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      spt[i].insert(a[i][j]);
    }
  }
  vector<int> ans(n + 1);
  ans.resize(0);
  while (n--) {
    int p[2], t;
    p[0] = spt[0].root->val;
    if (p[0] == -1) {
      p[0] = spt[0].root->c[1]->val;
    }
    p[1] = spt[1].find_pre(m - 1 - p[0]);
    int cur = 1;
    while ((t = spt[cur ^ 1].find_pre(m - 1 - p[cur])) != p[cur ^ 1]) {
      p[cur ^ 1] = t;
      t ^= 1;
    }
    ans.push_back((p[0] + p[1]) % m);
    spt[0].del(p[0]);
    spt[1].del(p[1]);
  }
  sort(ans.begin(), ans.end());
  for (int i = ans.size() - 1; i >= 0; i--) {
    printf("%d ", ans[i]);
  }
  return 0;
}
