#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
inline bool REMIN(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool REMAX(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
int toint(const string &s) {
  stringstream ss;
  ss << s;
  int x;
  ss >> x;
  return x;
}
string tostring(int number) {
  stringstream ss;
  ss << number;
  return ss.str();
}
int bit(long long x, int pos) { return ((1ll << pos) & x) ? 1 : 0; }
const int INF = 1e9;
const int NMAX = 1e5 + 5;
const long long MOD = 1000000007;
const long double PI = 2 * acos(0);
long long power(long long base, long long exp, long long c = MOD) {
  if (!exp) return 1;
  long long r = power(base, exp / 2, c);
  r = (r * r) % c;
  if (exp & 1) r = (r * base) % c;
  return r;
}
int T, N, M;
int a, b, c;
string s1, s2;
void nope(int dec = 0) {
  if (!dec) cout << "NO";
  exit(0);
}
map<int, int> A, B;
int ans[NMAX];
int getbest(int fornum, map<int, int> &frommap) {
  int target = M - fornum;
  auto ptr = frommap.lower_bound(target);
  if (ptr != frommap.begin())
    ptr--;
  else {
    ptr = frommap.end();
    ptr--;
  }
  return ptr->first;
}
void findpair(map<int, int> &ori, int fornum, map<int, int> &frommap,
              int cmp = -1) {
  int love = getbest(fornum, frommap);
  int child = (love + fornum) % M;
  if (child == cmp) {
    ori[fornum]--;
    if (!ori[fornum]) ori.erase(fornum);
    frommap[love]--;
    if (!frommap[love]) frommap.erase(love);
    ans[child]++;
    return;
  }
  findpair(frommap, love, ori, child);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  for (int(i) = int(1); (i) <= int(N); ++(i)) {
    cin >> a;
    A[a]++;
  }
  for (int(i) = int(1); (i) <= int(N); ++(i)) {
    cin >> b;
    B[b]++;
  }
  for (int(i) = int(1); (i) <= int(N); ++(i)) {
    findpair(A, A.begin()->first, B);
  }
  for (int(i) = int(M - 1); (i) >= int(0); --(i))
    while (ans[i]--) cout << i << ' ';
  return 0;
}
