#include <bits/stdc++.h>
using namespace std;
int n, m, a[100100][2], match[100100][2], t1[100100], t2[100100];
vector<int> ans;
bool mark[100100][2];
set<pair<int, int> > s[2];
int getmatch(int x, int y) {
  if (match[x][y] != -1 && mark[match[x][y]][!y]) return match[x][y];
  set<pair<int, int> >::iterator it;
  it = s[!y].upper_bound(make_pair(m - a[x][y] - 1, n + 1));
  if (it == s[!y].begin()) it = s[!y].end();
  it--;
  pair<int, int> p = *it;
  match[x][y] = p.second;
  return p.second;
}
void change(int x, int x2, int y) {
  mark[x][y] = 1;
  mark[x2][!y] = 1;
  s[y].erase(make_pair(a[x][y], x));
  s[!y].erase(make_pair(a[x2][!y], x2));
}
void chap(int y) {
  for (set<pair<int, int> >::iterator it = s[y].begin(); it != s[y].end();
       it++) {
    pair<int, int> p = *it;
    cout << p.first << " " << p.second << endl;
  }
}
void matching(int x, int y) {
  int x2 = getmatch(x, y);
  while (getmatch(x2, !y) != x) {
    matching(x2, !y);
    match[x][y] = -1;
    x2 = getmatch(x, y);
  }
  change(x, x2, y);
  ans.push_back((a[x][y] + a[x2][!y]) % m);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) match[i][0] = -1, match[i][1] = -1;
  for (int i = 0; i < n; i++) cin >> t1[i];
  for (int i = 0; i < n; i++) cin >> t2[i];
  sort(t1, t1 + n);
  sort(t2, t2 + n);
  for (int i = 0; i < n; i++) {
    a[i][0] = t1[i];
    a[i][1] = t2[i];
    s[0].insert(make_pair(a[i][0], i));
    s[1].insert(make_pair(a[i][1], i));
  }
  for (int i = 0; i < n; i++)
    if (!mark[i][0]) matching(i, 0);
  sort(ans.begin(), ans.end());
  reverse(ans.begin(), ans.end());
  for (int i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}
