#include <bits/stdc++.h>
using namespace std;
int n, m;
struct Node {
  int v, k;
} a2[100005];
stack<Node> st;
int vis1[100005], vis2[100005], a1[100005], ans[100005];
bool cmp1(int a, int b) { return a > b; }
bool cmp2(Node a, Node b) { return a.v < b.v; }
int main() {
  int i, j, x, k;
  while (~scanf("%d %d", &n, &m)) {
    memset(vis1, 0, sizeof(vis1));
    memset(vis2, 0, sizeof(vis2));
    memset(ans, 0, sizeof(ans));
    for (i = 0; i < n; ++i) {
      scanf("%d", &a1[i]);
      a1[i] %= m;
    }
    for (i = 0; i < n; ++i) {
      scanf("%d", &a2[i].v);
      a2[i].v %= m;
    }
    sort(a1, a1 + n, cmp1);
    sort(a2, a2 + n, cmp2);
    for (i = 0; i < n; ++i) {
      a2[i].k = i;
    }
    while (!st.empty()) st.pop();
    for (i = 0, j = 0; i < n; ++i) {
      while (j < n && (a2[j].v + a1[i]) < m) {
        st.push(a2[j]);
        j++;
      }
      if (!st.empty()) {
        Node s0 = st.top();
        ans[a1[i] + s0.v]++;
        st.pop();
        vis1[i] = 1;
        vis2[s0.k] = 1;
      }
    }
    for (i = 0; i < n; ++i) {
      if (vis1[i] == 0) {
        for (j = n - 1; j >= 0; --j) {
          if (vis2[j] == 0) {
            ans[(a1[i] + a2[j].v) % m]++;
            vis1[i] = 1;
            vis2[j] = 1;
            break;
          }
        }
      }
    }
    for (i = m - 1; i >= 0; --i) {
      for (j = 0; j < ans[i]; j++) printf("%d ", i);
    }
    printf("\n");
  }
  return 0;
}
