#include <bits/stdc++.h>
using namespace std;
int cnt[2][100001];
int s[100001], q[100001], ans[100001];
int main() {
  int n, m, k;
  int top = 0, back = 0, acount = 0;
  scanf("%d", &n), scanf("%d", &m);
  for (int i = (int)0; i < (int)2; ++i)
    for (int j = (int)0; j < (int)n; ++j) scanf("%d", &k), cnt[i][k]++;
  for (int i = (int)0; i < (int)m; ++i) {
    while (cnt[0][i]--) s[++top] = i;
    k = m - 1 - i;
    while (cnt[1][k]--) {
      if (top)
        ans[acount++] = k + s[top--];
      else
        q[++back] = k;
    }
  }
  int head = 1;
  while (top) {
    ans[acount++] = (s[top--] + q[head++]) % m;
  }
  sort(ans, ans + n);
  for (k = acount - 1; k >= 0; k--) printf("%d ", ans[k]);
  printf("\n");
  return 0;
}
