#include <bits/stdc++.h>
using namespace std;
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}
template <class F, class T>
void convert(const F &f, T &t) {
  stringstream ss;
  ss << f;
  ss >> t;
}
int cnt1[100010];
inline map<int, int>::iterator findbest(int m, int x, map<int, int> &mp) {
  int y = m - 1 - x;
  if (y < 0) {
    y += m;
  }
  map<int, int>::iterator it = mp.upper_bound(y);
  if (it == mp.begin()) {
    it = mp.end();
  }
  --it;
  return it;
}
int main() {
  int n, m, d;
  scanf("%d%d", &n, &m);
  map<int, int> cnt2;
  map<int, int>::iterator it;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &d);
    ++cnt1[d];
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &d);
    ++cnt2[d];
  }
  priority_queue<pair<int, int> > pq;
  for (int i = 0; i < m; ++i) {
    if (cnt1[i]) {
      it = findbest(m, i, cnt2);
      int s = i + it->first;
      if (s >= m) {
        s -= m;
      }
      pq.push(pair<int, int>(s, i));
    }
  }
  vector<int> ans;
  ans.reserve(n);
  while (!cnt2.empty()) {
    pair<int, int> p = pq.top();
    pq.pop();
    int s = p.first;
    int t = p.second;
    int u = s - t;
    if (u < 0) {
      u += m;
    }
    it = cnt2.find(u);
    if (it == cnt2.end()) {
      it = findbest(m, t, cnt2);
      s = t + it->first;
      if (s >= m) {
        s -= m;
      }
      pq.push(pair<int, int>(s, t));
    } else {
      ans.push_back(s);
      int k = --it->second;
      if (!k) {
        cnt2.erase(it);
      }
      if (--cnt1[t]) {
        if (!k) {
          it = findbest(m, t, cnt2);
        }
        s = t + it->first;
        if (s >= m) {
          s -= m;
        }
        pq.push(pair<int, int>(s, t));
      }
    }
  }
  for (int i = 0; i < ans.size(); ++i) {
    if (i != 0) {
      putchar(' ');
    }
    printf("%d", ans[i]);
  }
  puts("");
}
