#include <bits/stdc++.h>
using namespace std;
int n, m, x, a[100003], b[100003], s[100003], r[100003], stk[100003], q[100003];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    ++a[x];
  }
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    ++b[m - 1 - x];
  }
  int top = 0, cnt = 0, tail = 0;
  for (int i = m - 1; i >= 0; --i) {
    while (b[i]--) stk[++top] = m - 1 - i;
    while (a[i]--) {
      if (top)
        r[++cnt] = stk[top--] + i;
      else
        q[++tail] = i;
    }
  }
  for (int i = 1; i <= tail; ++i) r[++cnt] = q[i] + stk[top--] - m;
  sort(r + 1, r + 1 + cnt);
  for (int i = cnt; i; --i) printf("%d ", r[i]);
  return 0;
}
