#include <bits/stdc++.h>
using namespace std;
int N, M, A;
int c1[100000], c2[100000];
stack<int> st;
vector<int> zan;
int main() {
  scanf("%d%d", &N, &M);
  for (int(i) = 0; (i) < (N); (i)++) scanf("%d", &A), c1[A]++;
  for (int(i) = 0; (i) < (N); (i)++) scanf("%d", &A), c2[A]++;
  vector<int> lis;
  for (int(i) = 0; (i) < (M); (i)++) {
    while (c1[i] && c2[M - 1 - i])
      lis.push_back(M - 1), c1[i]--, c2[M - 1 - i]--;
    while (c1[i]) st.push(i), c1[i]--;
    while (c2[M - 1 - i] && !st.empty())
      lis.push_back(M - 1 - i + st.top()), c2[M - 1 - i]--, st.pop();
    while (c2[M - 1 - i]) c2[M - 1 - i]--, zan.push_back(M - 1 - i);
  }
  for (int(i) = 0; (i) < (zan.size()); (i)++)
    lis.push_back(zan[i] + st.top() - M), st.pop();
  sort((lis).begin(), (lis).end());
  reverse((lis).begin(), (lis).end());
  for (int(i) = 0; (i) < (N); (i)++)
    printf("%d%c", lis[i], i + 1 == N ? '\n' : ' ');
}
