#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000001;
int n, m, x;
pair<int, int> a[maxn];
int st[maxn], q[maxn], cnt, ans[maxn], tail, top;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].first);
  }
  int x;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[n + i].first = m - 1 - x;
    a[n + i].second = 1;
  }
  sort(a + 1, a + 1 + 2 * n);
  top = 0;
  tail = 0;
  for (int i = 1; i <= 2 * n; i++) {
    if (a[i].second == 0)
      st[++top] = a[i].first;
    else {
      if (top == 0)
        q[++tail] = a[i].first;
      else
        ans[++cnt] = (m - 1 - a[i].first + st[top--]) % m;
    }
  }
  for (int i = 1; i <= tail; i++)
    ans[++cnt] = (st[i] + m - 1 - q[tail - i + 1]) % m;
  sort(ans + 1, ans + 1 + n);
  reverse(ans + 1, ans + 1 + n);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  cout << endl;
  fclose(stdin);
  return 0;
}
