#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010];
int A[100010], B[100010];
vector<int> ans;
bool cmp(int x, int y) { return x > y; }
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[x]++;
  }
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    b[x]++;
  }
  int na = 0, nb = 0;
  for (int i = m - 1; i >= 0; i--) {
    while (b[m - 1 - i]--) B[++nb] = m - 1 - i;
    while (a[i]--) {
      if (nb) {
        ans.push_back(i + B[nb]);
        nb--;
      } else
        A[++na] = i;
    }
  }
  for (int i = 1; i <= na; i++) ans.push_back(A[i] + B[nb - i + 1] - m);
  sort(ans.begin(), ans.end(), cmp);
  for (int v : ans) printf("%d ", v);
  return 0;
}
