#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100005], b[100005], c[100005], d[100005], ans[100005];
void read(int t[]) {
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    t[x]++;
  }
}
int main() {
  int l = 0, s = 0, x = 0;
  scanf("%d%d", &n, &m);
  read(a);
  read(b);
  for (int i = m - 1; i >= 0; i--) {
    while (b[m - i - 1]--) c[l++] = m - i - 1;
    while (a[i]--) {
      if (l)
        ans[s++] = c[--l] + i;
      else
        d[x++] = i;
    }
  }
  for (int i = 0; i < x; i++) {
    ans[s++] = (d[i] + c[--l]) % m;
  }
  sort(ans, ans + n, greater<int>());
  for (int i = 0; i < n; i++) {
    if (i) printf(" ");
    printf("%d", ans[i]);
  }
  return 0;
}
