#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100100;
int a[MAXN], b[MAXN];
int r[MAXN];
int main() {
  memset(a, 0, sizeof a);
  memset(b, 0, sizeof b);
  memset(r, 0, sizeof r);
  int n, m;
  cin >> n >> m;
  set<int> s1, s2, g1, g2, f1, f2;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a[x]++;
    if (x >= (m + 1) / 2)
      s1.insert(-x);
    else
      g1.insert(-x);
  }
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    b[x]++;
    if (x < (m + 1) / 2)
      s2.insert(-x);
    else
      g2.insert(-x);
  }
  for (auto i : s1) {
    int at = -i;
    while (true) {
      auto h = s2.lower_bound(-m + 1 + at);
      if (h == s2.end()) break;
      int p = -*h;
      if (a[at] >= b[p])
        s2.erase(-p), r[(at + p) % m] += b[p], a[at] -= b[p], b[p] = 0;
      else {
        r[(at + p) % m] += a[at], b[p] -= a[at], a[at] = 0;
        break;
      }
    }
  }
  for (auto i : g2) {
    int at = -i;
    while (true) {
      auto h = g1.lower_bound(-m + 1 + at);
      if (h == g1.end()) break;
      int p = -*h;
      if (b[at] >= a[p])
        g1.erase(-p), r[(at + p) % m] += a[p], b[at] -= a[p], a[p] = 0;
      else {
        r[(at + p) % m] += b[at], a[p] -= b[at], b[at] = 0;
        break;
      }
    }
  }
  for (auto i : g1) {
    int at = -i;
    while (true) {
      auto h = s2.lower_bound(-m);
      if (h == s2.end()) break;
      int p = -*h;
      if (a[at] >= b[p])
        s2.erase(-p), r[(at + p) % m] += b[p], a[at] -= b[p], b[p] = 0;
      else {
        r[(at + p) % m] += a[at], b[p] -= a[at], a[at] = 0;
        break;
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if (a[i] > 0) f1.insert(-i);
    if (b[i] > 0) f2.insert(i);
  }
  for (auto i : f1) {
    int at = -i;
    while (true) {
      if (f2.size() == 0) break;
      auto h = f2.rbegin();
      int p = *h;
      if (a[at] >= b[p])
        f2.erase(p), r[(at + p) % m] += b[p], a[at] -= b[p], b[p] = 0;
      else {
        r[(at + p) % m] += a[at], b[p] -= a[at], a[at] = 0;
        break;
      }
    }
  }
  for (int i = m; i >= 0; i--) {
    for (int j = 1; j <= r[i]; j++) cout << i << " ";
  }
}
