#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m;
int f1[100010], f2[100010], g[100010], an[100010], re[100010];
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &k), f1[k]++;
  for (i = 1; i <= n; i++) scanf("%d", &k), f2[k]++;
  for (i = m - 1; i >= 0; i--) {
    for (; f2[m - 1 - i]; f2[m - 1 - i]--) g[++*g] = m - 1 - i;
    for (; f1[i]; f1[i]--) {
      if (*g)
        an[++*an] = i + g[(*g)--];
      else
        re[++*re] = i;
    }
  }
  for (i = 1; i <= *re; i++) an[++*an] = re[i] + g[(*g)--] - m;
  sort(an + 1, an + n + 1);
  reverse(an + 1, an + n + 1);
  for (i = 1; i <= n; i++) printf("%d ", an[i]);
  printf("\n");
  return 0;
}
