#include <bits/stdc++.h>
using namespace std;
inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a < b ? a : b; }
inline int gcd(int a, int b) {
  if (a % b)
    return gcd(b, a % b);
  else
    return b;
}
inline int lcm(int a, int b) { return (a * (b / gcd(a, b))); }
inline int And(int mask, int bit) { return mask & (1 << bit); }
inline int Or(int mask, int bit) { return mask | (1 << bit); }
inline int Xor(int mask, int bit) { return mask & (~(1 << bit)); }
int a[2][100100], ans[100100], num1[100100], num2[100100];
int sz, n, m, x, i1, i2;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < n; j++) {
      scanf("%d", &x);
      a[i][x]++;
    }
  i1 = i2 = sz = 0;
  for (int i = 0; i < m; i++) {
    while (a[0][i]--) num1[++i1] = i;
    while (a[1][m - 1 - i]--) {
      if (i1)
        ans[sz++] = num1[i1--] + m - 1 - i;
      else
        num2[++i2] = m - 1 - i;
    }
  }
  i2 = 0;
  while (i1) ans[sz++] = (num1[i1--] + num2[++i2]) % m;
  sort(ans, ans + sz);
  reverse(ans, ans + sz);
  for (int i = 0; i < sz - 1; i++) printf("%d ", ans[i]);
  printf("%d\n", ans[sz - 1]);
}
