#include <bits/stdc++.h>
using namespace std;
const int maxN = 100 * 1000 + 2;
const int mod = 1000 * 1000 * 1000 + 7;
int ans[maxN];
multiset<int> s[2];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    s[0].insert(x);
  }
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    s[1].insert(m - 1 - x);
  }
  for (int i = 0; i < n; i++) {
    int ret1 = *s[0].rbegin();
    auto it1 = s[1].lower_bound(ret1);
    if (it1 == s[1].end()) it1 = s[1].begin();
    int ret2 = *it1;
    it1 = s[0].upper_bound(ret2);
    if (it1 == s[0].begin())
      it1 = s[0].find(*s[0].rbegin());
    else
      it1--;
    int ret3 = *it1;
    if ((ret3 + m - 1 - ret2) % m > (ret1 + m - 1 - ret2) % m) ret1 = ret3;
    s[0].erase(s[0].find(ret1));
    s[1].erase(s[1].find(ret2));
    ans[i] = (ret1 + m - 1 - ret2) % m;
  }
  sort(ans, ans + n, greater<int>());
  for (int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
