#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e5 + 10;
int a[N], b[N];
stack<int> s;
queue<int> Q;
vector<int> ans;
int main() {
  int n, m, k;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> k;
    a[k]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> k;
    b[k]++;
  }
  int now = m - 1;
  for (int i = 0; i < m; i++) {
    while (a[i] > 0) {
      s.push(i);
      a[i]--;
    }
    while (b[now] > 0) {
      if (!s.empty()) {
        ans.push_back((now + s.top()));
        s.pop();
      } else
        Q.push(now);
      b[now]--;
    }
    now--;
  }
  while (!s.empty()) {
    ans.push_back((s.top() + Q.front()) % m);
    s.pop();
    Q.pop();
  }
  sort(ans.begin(), ans.end());
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
