#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 2e9;
const long long INF64 = 1e18;
const long double EPS = 1e-12;
const long double PI = 3.1415926535897932384626433832795028841;
const long long MD = 925262732;
const long long T = 634521;
const int N = 200100;
const int M = 301;
int n, m, a[N], b[N];
vector<int> ans;
stack<int> s1, s2;
queue<int> q1, q2;
int main() {
  cin >> n >> m;
  for (int i = 0; i < int(n); i++) {
    int first;
    scanf("%d", &first);
    a[first]++;
  }
  for (int i = 0; i < int(n); i++) {
    int first;
    scanf("%d", &first);
    b[first]++;
  }
  int j = 0;
  for (int i = m - 1; i >= 0; i--) {
    if (a[i] >= b[j]) {
      for (int u = 0; u < int(b[j]); u++) ans.push_back(m - 1);
      a[i] -= b[j];
      b[j] = 0;
      while (!s1.empty() && a[i] > 0) {
        ans.push_back(i + s1.top());
        b[s1.top()]--;
        s1.pop();
        a[i]--;
      }
    } else {
      for (int u = 0; u < int(a[i]); u++) ans.push_back(m - 1);
      b[j] -= a[i];
      a[i] = 0;
      for (int u = 0; u < int(b[j]); u++) s1.push(j);
    }
    j++;
  }
  for (int i = m - 1; i >= 0; i--) {
    int j = i;
    while (!q1.empty() && a[i] > 0) {
      ans.push_back((i + q1.front()) % m);
      q1.pop();
      a[i]--;
    }
    while (!q2.empty() && b[i] > 0) {
      ans.push_back((i + q2.front()) % m);
      q2.pop();
      b[i]--;
    }
    if (a[i] >= b[j]) {
      for (int u = 0; u < int(b[j]); u++) ans.push_back((i * 2) % m);
      a[i] -= b[j];
      b[j] = 0;
      while (!q1.empty() && a[i] > 0) {
        ans.push_back((i + q1.front()) % m);
        q1.pop();
        a[i]--;
      }
      for (int u = 0; u < int(a[i]); u++) q2.push(i);
    } else {
      for (int u = 0; u < int(a[i]); u++) ans.push_back((i * 2) % m);
      b[j] -= a[i];
      a[i] = 0;
      while (!q2.empty() && b[i] > 0) {
        ans.push_back((i + q2.front()) % m);
        q2.pop();
        b[i]--;
      }
      for (int u = 0; u < int(b[j]); u++) q1.push(j);
    }
  }
  sort((ans).begin(), (ans).end());
  reverse((ans).begin(), (ans).end());
  for (int i = 0; i < int(int((ans).size())); i++) printf("%d ", ans[i]);
  return 0;
}
