#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int cnt[N][2];
stack<int> S;
signed main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    cnt[x][0]++;
  }
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    cnt[x][1]++;
  }
  vector<int> ans;
  for (int i = 0; i < m; ++i) {
    while (cnt[i][0]) --cnt[i][0], S.push(i);
    while (cnt[m - i - 1][1] && !S.empty())
      ans.push_back(m - i - 1 + S.top()), S.pop(), cnt[m - i - 1][1]--;
  }
  vector<int> S1, S2;
  for (int i = m - 1; i >= 0; --i)
    while (cnt[i][1]) --cnt[i][1], S2.push_back(i);
  while (!S.empty()) S1.push_back(S.top()), S.pop();
  for (int i = 0; i < min(S2.size(), S1.size()); ++i)
    ans.push_back((S1[i] + S2[i]) % m);
  sort(ans.begin(), ans.end(), [](int i, int j) { return i > j; });
  for (int v : ans) cout << v << " ";
}
