#include <bits/stdc++.h>
using namespace std;
const long long inf = INT_MAX, df = 1e5 + 7;
long long i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a[df], b[df],
    sta[df], top, c[df];
inline long long read() {
  long long x = 0, y = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') y = (ch == '-') ? -1 : 1, ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
  return x * y;
}
int main() {
  n = read(), m = read();
  for (long long i = (1); i <= (n); ++i) a[read()]++;
  for (long long i = (1); i <= (n); ++i) b[read()]++;
  for (long long k = (0); k <= (1); ++k) {
    for (long long i = (0); i <= (m - 1); ++i) {
      while (a[i] != 0) sta[++top] = i, --a[i];
      while (top && b[m - i - 1] > 0)
        c[(sta[top--] + m - i - 1) % m]++, b[m - i - 1]--;
    }
  }
  long long tot = n;
  for (long long i = (m - 1); i >= (0); --i) {
    while (c[i] && tot) tot--, printf("%lld ", i), c[i]--;
  }
  return 0;
}
