#include <bits/stdc++.h>
using namespace std;
int ABS(int a) {
  if (a < 0) return (-a);
  return a;
}
int main() {
  cin.sync_with_stdio(false);
  int i, n, m, x;
  cin >> n >> m;
  multiset<int> s1, s2;
  for (i = (0); i < (n); ++i) {
    cin >> x;
    s1.insert(x);
  }
  for (i = (0); i < (n); ++i) {
    cin >> x;
    s2.insert(x);
  }
  priority_queue<pair<int, pair<int, int> > > q;
  multiset<int>::iterator it1, it2;
  for (it1 = s1.begin(); it1 != s1.end(); ++it1) {
    int x = *it1;
    int f = m - x - 1;
    it2 = s2.upper_bound(f);
    if (it2 == s2.begin()) it2 = s2.end();
    it2--;
    int y = *it2;
    int add = (x + y) % m;
    q.push(pair<int, pair<int, int> >(add, pair<int, int>(x, y)));
  }
  vector<int> ret;
  while (true) {
    pair<int, pair<int, int> > where = q.top();
    int val = where.first;
    int from = where.second.first;
    int to = where.second.second;
    q.pop();
    it1 = s1.find(from);
    it2 = s2.find(to);
    if (it1 == s1.end()) continue;
    if (it2 == s2.end()) {
      it2 = s2.upper_bound(to);
      if (it2 == s2.begin()) it2 = s2.end();
      it2--;
      to = *it2;
      int add = to + from;
      add %= m;
      q.push(pair<int, pair<int, int> >(add, pair<int, int>(from, to)));
      continue;
    }
    ret.push_back(val);
    if (ret.size() == n) break;
    s1.erase(it1);
    s2.erase(it2);
  }
  for (i = (0); i < (n); ++i) cout << ret[i] << " ";
  cout << endl;
  return 0;
}
