#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 21;
multiset<int> n[2];
vector<int> ans;
int t, m;
void input() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> t >> m;
  for (int i = 0; i < t; i++) {
    int x;
    cin >> x;
    n[0].insert(x);
  }
  for (int i = 0; i < t; i++) {
    int x;
    cin >> x;
    n[1].insert(x);
  }
}
void merge(int u, int v) { ans.push_back((u + v) % m); }
int find(int v, int t) {
  t %= 2;
  int l = -1, r = m;
  while (r - l > 1) {
    int mid = (r + l) / 2;
    set<int>::iterator it = n[t].lower_bound((mid - v + m) % m);
    if (it == n[t].end()) {
      it = n[t].lower_bound((mid - v) % m);
      if (it == n[t].end()) {
        r = mid;
        continue;
      }
      int ja = *it;
      if ((ja + v) < m)
        l = mid;
      else
        r = mid;
      continue;
    }
    int k = *it;
    if ((k + v) % m >= mid)
      l = mid;
    else {
      r = mid;
    }
  }
  return (l + m - v) % m;
}
bool dfs(int v, int w, int t) {
  t %= 2;
  set<int>::iterator it = n[t].find(v);
  n[t].erase(it);
  while (1) {
    if (!int(n[(t + 1) % 2].size())) {
      return 1;
    }
    int u = find(v, t + 1);
    int nw = (v + u) % m;
    if (nw <= w) return 1;
    if (dfs(u, nw, t + 1)) {
      merge(u, v);
      return 0;
    }
  }
  return 1;
}
int main() {
  input();
  while (!n[0].empty()) {
    dfs(*n[0].begin(), -1, 0);
  }
  sort(ans.begin(), ans.end());
  for (int i = int(ans.size()) - 1; i >= 0; i--) {
    cout << ans[i] << " ";
  }
  return 0;
}
