#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 10, INF = 1e8;
int s1[N], s2[N], ans[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, tmp;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    s1[tmp]++;
  }
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    s2[tmp]++;
  }
  stack<int> st;
  for (int j = 0; j < 2; j++) {
    for (int i = 0; i < m; i++) {
      while (s1[i]) {
        st.push(i);
        s1[i]--;
      }
      while (!st.empty() && s2[m - 1 - i]) {
        int x = st.top();
        st.pop();
        ans[(x + m - 1 - i) % m]++;
        s2[m - 1 - i]--;
      }
    }
  }
  for (int i = m - 1; i >= 0; i--) {
    while (ans[i]--) {
      cout << i << " ";
    }
  }
}
