#include <bits/stdc++.h>
using namespace std;
multiset<pair<int, pair<int, int> > > s1;
multiset<int> s;
vector<int> a;
vector<int> res;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  a.resize(n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  sort(a.begin(), a.end());
  for (int i = (0); i < (n); ++i) {
    int v;
    scanf("%d", &v);
    s.insert(v);
  }
  for (int i = (0); i < (n); ++i) {
    int c = m - 1 - a[i];
    if (c < 0) c += m;
    multiset<int>::iterator it = s.upper_bound(c);
    if (it == s.begin()) it = s.end();
    it--;
    int v = *it;
    int w = v;
    v += a[i];
    if (v >= m) v -= m;
    s1.insert(make_pair(-v, make_pair(a[i], w)));
  }
  int was = 0;
  while (s1.size()) {
    pair<int, pair<int, int> > t = *s1.begin();
    multiset<int>::iterator it = s.find(t.second.second);
    if (s.find(t.second.second) != s.end()) {
      if (was) printf(" ");
      was = 1;
      printf("%d", -t.first);
      s.erase(it);
      s1.erase(s1.begin());
    } else {
      int c = m - 1 - t.second.first;
      if (c < 0) c += m;
      s1.erase(s1.begin());
      multiset<int>::iterator it = s.upper_bound(c);
      if (it == s.begin()) it = s.end();
      it--;
      int v = *it;
      int w = v;
      v += t.second.first;
      if (v >= m) v -= m;
      s1.insert(make_pair(-v, make_pair(t.second.first, w)));
    }
  }
  printf("\n");
  return 0;
}
