#include <bits/stdc++.h>
const long double PI = acos(-1);
const long double eps = 0.0000000001;
const long long INF = 0x3fffffffffffffff;
long long n, m;
std::map<long long, long long> ac, bc;
std::priority_queue<std::pair<long long, long long>> que;
void get(long long x) {
  std::map<long long, long long>::iterator i = bc.lower_bound(m - x);
  if (i == bc.begin())
    que.push({bc.rbegin()->first + x - m, x});
  else
    que.push({(--i)->first + x, x});
}
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin >> n >> m;
  for (long long i = 1; i <= n; ++i) {
    static long long x;
    std::cin >> x;
    ++ac[x % m];
  }
  for (long long i = 1; i <= n; ++i) {
    static long long x;
    std::cin >> x;
    ++bc[x % m];
  }
  for (auto i : ac) get(i.first);
  while (!que.empty()) {
    std::pair<long long, long long> now = que.top();
    que.pop();
    if (bc.find((now.first - now.second + m) % m) == bc.end())
      get(now.second);
    else {
      std::cout << now.first << ' ';
      if (!--bc[(now.first - now.second + m) % m])
        bc.erase((now.first - now.second + m) % m);
      if (--ac[now.second])
        get(now.second);
      else
        ac.erase(now.second);
    }
  }
  return 0;
}
