#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 100;
int n, m, a[maxN], b[maxN], mr1[maxN], mr2[maxN];
vector<int> v, x;
multiset<int> s;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mr1[a[i]]++;
  }
  s.insert(-1);
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    s.insert(b[i]);
    mr2[b[i]]++;
  }
  sort(b, b + n);
  int cnt = 0;
  for (int i = m - 1; i >= 0; i--) {
    while (mr1[i]) {
      multiset<int>::iterator it = s.lower_bound(m - i);
      it--;
      int sd = *it;
      if (sd == -1) break;
      mr1[i]--;
      v.push_back(sd + i);
      s.erase(it);
    }
  }
  for (multiset<int>::iterator it = s.begin(); it != s.end(); it++)
    x.push_back(*it);
  sort(x.begin(), x.end());
  cnt = (int)x.size() - 1;
  for (int i = m - 1; i >= 0; i--) {
    while (mr1[i] && cnt > 0) {
      mr1[i]--;
      v.push_back((x[cnt] + i) % m);
      cnt--;
    }
  }
  sort(v.begin(), v.end());
  for (long long int i = (int)v.size() - 1; i >= 0; i--) cout << v[i] << ' ';
}
