#include <bits/stdc++.h>
using namespace std;
vector<int> ver;
stack<int> sta;
int c1[100010], c2[100010], ans[100010];
int main() {
  int n, m;
  ver.clear();
  while (!sta.empty()) sta.pop();
  memset(c1, 0, sizeof(c1));
  memset(c2, 0, sizeof(c2));
  memset(ans, 0, sizeof(ans));
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    c1[x]++;
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    c2[x]++;
  }
  for (int i = 0; i < m; i++) {
    while (c1[i]) sta.push(i), c1[i]--;
    while (c2[m - 1 - i]) {
      if (!sta.empty())
        ans[(sta.top() + m - 1 - i) % m]++, sta.pop();
      else
        ver.push_back(m - 1 - i);
      c2[m - 1 - i]--;
    }
  }
  int size = ver.size();
  for (int i = 0; i < size; i++) ans[(sta.top() + ver[i]) % m]++, sta.pop();
  for (int i = m - 1; i >= 0; i--)
    while (ans[i]) cout << i << " ", ans[i]--;
  cout << endl;
}
