#include <bits/stdc++.h>
using namespace std;
void _fill_int(int* p, int val, int rep) {
  int i;
  for (i = 0; i < rep; i++) p[i] = val;
}
int GETi() {
  int i;
  scanf("%d", &i);
  return i;
}
template <class T>
T sqr(T val) {
  return val * val;
}
signed long long N, M;
int num[2][100001];
vector<int> res, D;
stack<int> S;
void solve() {
  int f, r, i, j, k, l, x, y, z;
  cin >> N >> M;
  for (x = 0; x < N; x++) num[0][GETi()]++;
  for (x = 0; x < N; x++) num[1][M - 1 - GETi()]++;
  for (i = M - 1; i >= 0; i--) {
    while (num[0][i] && num[1][i])
      res.push_back(M - 1), num[0][i]--, num[1][i]--;
    while (num[1][i]) S.push(M - 1 - i), num[1][i]--;
    while (num[0][i] && !S.empty())
      res.push_back((i + S.top()) % M), num[0][i]--, S.pop();
    while (num[0][i]) D.push_back(i), num[0][i]--;
  }
  for (i = 0; i < D.size(); i++) res.push_back((D[i] + S.top()) % M), S.pop();
  sort(res.rbegin(), res.rend());
  for (i = 0; i < N; i++) printf("%d ", res[i]);
  printf("\n");
  return;
}
int main(int argc, char** argv) {
  if (argc > 1) freopen(argv[1], "r", stdin);
  solve();
  return 0;
}
