#include <bits/stdc++.h>
const int maxn = 0x3f3f3f3f;
const double EI =
    2.71828182845904523536028747135266249775724709369995957496696762772407663035354594571382178525166427;
const double PI = 3.141592653589793238462643383279;
using namespace std;
int c[100010], d[100010], ans[100010], v1[100010], v2[100010], zz[100010];
int main(void) {
  int n, m, i, cnt;
  while (~scanf("%d %d", &n, &m)) {
    memset(ans, 0, sizeof(ans));
    memset(v1, 0, sizeof(v1));
    memset(v2, 0, sizeof(v2));
    cnt = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", c + i);
      v1[c[i]]++;
    }
    for (i = 0; i < n; i++) {
      scanf("%d", d + i);
      v2[d[i]]++;
    }
    int tmp = 2;
    while (tmp--) {
      for (i = 0; i <= m - 1; i++) {
        while (v1[i] > 0) {
          v1[i]--;
          zz[cnt++] = i;
        }
        while (cnt > 0 && v2[m - 1 - i] > 0) {
          v2[m - 1 - i]--;
          ans[(m - 1 - i + zz[cnt - 1]) % m]++;
          cnt--;
        }
      }
    }
    int zzz = 1;
    for (i = m - 1; i >= 0; i--) {
      while (ans[i] > 0) {
        ans[i]--;
        if (zzz == 1) {
          zzz = 0;
          printf("%d", i);
        } else {
          printf(" %d", i);
        }
      }
    }
    printf("\n");
  }
  return 0;
}
