#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e6;
int n, m, value, b[N], cnt[N];
set<int>::iterator it;
set<int> a;
vector<int> ans;
bool mark[N];
bool cmp(int lhs, int rhs) { return lhs > rhs; }
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> value;
    a.insert(-value);
    cnt[value]++;
  }
  for (int i = 0; i < n; i++) cin >> b[i];
  sort(b, b + n, cmp);
  for (int i = 0; i < n; i++) {
    it = a.lower_bound(-(m - 1 - b[i]));
    if (it != a.end()) {
      ans.push_back(-(*it) + b[i]);
      mark[i]++;
      cnt[-(*it)]--;
      if (!cnt[-(*it)]) a.erase(it);
    }
  }
  for (int i = 0; i < n; i++) {
    if (!mark[i]) {
      it = a.begin();
      ans.push_back((-(*it) + b[i]) % m);
      cnt[-(*it)]--;
      if (!cnt[-(*it)]) a.erase(it);
    }
  }
  sort(ans.begin(), ans.end(), cmp);
  for (auto i : ans) cout << i << ' ';
  cout << '\n';
  return 0;
}
