#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100005];
int b[100005];
struct cc {
  int x;
  int a;
  int p;
};
cc c[200005];
bool operator<(cc a, cc b) {
  if (a.x < b.x) return true;
  if (a.x > b.x) return false;
  if (a.a == 1 && b.a == 0) return false;
  if (a.a == 0 && b.a == 1) return true;
  return false;
}
int l;
int as = 0;
int ans[100005];
void check(int i) {
  int j = (i + 1) % l;
  while (c[j].a != 0) {
    if (c[j].a == 1) check(j);
    j = c[j].p;
    j = (j + 1) % l;
  }
  c[i].p = j;
  c[i].a = 2;
  ans[as] = (c[i].x - c[j].x + m) % m;
  as++;
}
int main() {
  cin >> n >> m;
  l = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    c[l].x = a[i];
    c[l].a = 1;
    c[l].p = -1;
    l++;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    b[i] = m - b[i];
    c[l].x = b[i];
    c[l].a = 0;
    c[l].p = -1;
    l++;
  }
  sort(c, c + l);
  for (int i = 0; i < l; i++)
    if (c[i].a == 1) check(i);
  sort(ans, ans + as);
  for (int i = as - 1; i > 0; i--) printf("%d ", ans[i]);
  printf("%d\n", ans[0]);
}
