#include <bits/stdc++.h>
using namespace std;
int c[100001];
int p[100001];
int stk[100001];
int ans[100001];
int re[100001];
int re_sz;
int sz;
int cnt;
int main() {
  int n, m, t;
  while (scanf("%d %d", &n, &m) == 2) {
    re_sz = sz = cnt = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &t);
      p[t]++;
    }
    for (int i = 0; i < n; i++) {
      scanf("%d", &t);
      c[m - 1 - t]++;
    }
    for (int i = m - 1; i >= 0; i--) {
      while (c[i]--) stk[cnt++] = m - 1 - i;
      while (p[i]--) {
        if (cnt)
          ans[sz++] = stk[--cnt] + i;
        else
          re[re_sz++] = i;
      }
    }
    for (int i = 0; i < re_sz; i++) {
      ans[sz++] = (re[i] + stk[--cnt]) % m;
    }
    sort(ans, ans + sz);
    for (int i = sz - 1; i > -1; i--) {
      printf("%d%c", ans[i], (i == 0) ? '\n' : ' ');
    }
  }
  return 0;
}
