#include <bits/stdc++.h>
using namespace std;
int a[200000], b[200000], c[200000], x, n, m, p;
queue<int> q;
stack<int> s;
bool cmp(int x, int y) { return x > y; }
int main() {
  scanf("%d%d", &n, &m);
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    b[m - x - 1]++;
  }
  p = 0;
  for (int i = m; i >= 0; i--) {
    while (b[i]) {
      b[i]--;
      s.push(m - i - 1);
    }
    while (a[i]) {
      a[i]--;
      if (!s.empty()) {
        p++;
        c[p] = s.top() + i;
        s.pop();
      } else
        q.push(i);
    }
  }
  while (!q.empty()) {
    p++;
    c[p] = q.front() + s.top() - m;
    q.pop(), s.pop();
  }
  sort(c + 1, c + n + 1, cmp);
  for (int i = 1; i <= n; i++) printf("%d ", c[i]);
  return 0;
}
