#include <bits/stdc++.h>
const int N = 100005;
int n, m, k;
int a[N], b[N], c[N], st[N];
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0, x; i < n; i++) scanf("%d", &x), a[x]++;
  for (int i = 0, x; i < n; i++) scanf("%d", &x), b[x]++;
  for (int i = 0; i < m; i++) {
    for (int h = 0; h < a[i]; h++) st[++k] = i + 1;
    for (int h = 0; h < b[m - i - 1]; h++) {
      if (k && st[k] > 0)
        c[(st[k--] + m - i - 2) % m]++;
      else
        st[++k] = -(m - i);
    }
  }
  for (int i = 1; i <= k / 2; i++) c[(-st[i] + st[k - i + 1] - 2) % m]++;
  for (int i = m - 1; i >= 0; i--)
    for (int h = 0; h < c[i]; h++) printf("%d ", i);
}
