#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, c1[100100], c2[100100], g[100100], f[100100];
vector<int> ans;
int main() {
  scanf("%d %d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%d", &j);
    c1[j]++;
  }
  for (i = 1; i <= n; i++) {
    scanf("%d", &j);
    c2[j]++;
  }
  int cur1 = 0, cur2 = 0;
  for (i = 0; i < m; i++) {
    j = m - i - 1;
    while (c1[i]--) g[++cur1] = i;
    while (c2[j]--) {
      if (cur1 > 0)
        ans.push_back(g[cur1--] + j);
      else
        f[++cur2] = j;
    }
  }
  for (i = 1; i <= cur2; i++) ans.push_back((f[i] + g[cur1--]) % m);
  sort(ans.begin(), ans.end(), greater<int>());
  for (i = 0; i < n; i++) printf("%d ", ans[i]);
  return 0;
}
