#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010], s[100010];
int main() {
  int i, j, k, n, m;
  while (~scanf("%d%d", &n, &m)) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    for (i = 0; i < n; i++) scanf("%d", &b[i]), b[i] = m - 1 - b[i];
    sort(a, a + n);
    reverse(a, a + n);
    sort(b, b + n);
    reverse(b, b + n);
    j = 0;
    int top = 0;
    vector<int> v;
    for (i = 0; i < n; i++) {
      while (j < n && b[j] >= a[i]) s[++top] = j++;
      if (top) {
        v.push_back((m - 1 - b[s[top]] + a[i]) % m);
        b[s[top]] = -1;
        top--;
        a[i] = -1;
      }
    }
    for (i = 0, k = n - 1; i < n && k >= 0; i++)
      if (a[i] != -1) {
        while (b[k] == -1) k--;
        v.push_back((a[i] + m - 1 - b[k]) % m), k--;
      }
    sort((v).begin(), (v).end());
    for (i = n - 1; i >= 0; i--) printf("%d ", v[i]);
    puts("");
  }
  return 0;
}
