#include <bits/stdc++.h>
using namespace std;
const int mx = 100 * 1000 + 10;
int n, m, out[mx], a[2][mx];
vector<int> v;
void input() {
  cin >> n >> m;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < n; ++j) {
      int x;
      cin >> x;
      a[i][x]++;
    }
}
void solve() {
  for (int z = 0; z < 2; ++z) {
    for (int i = 0; i < m; ++i) {
      while (a[0][i] > 0) {
        v.push_back(i);
        a[0][i]--;
      }
      int j = m - (i + 1);
      while (a[1][j] > 0 && !v.empty()) {
        int x = v[v.size() - 1];
        v.pop_back();
        out[(x + j) % m]++;
        a[1][j]--;
      }
    }
  }
}
void output() {
  for (int i = m - 1; i >= 0; --i)
    while (out[i]--) cout << i << " ";
}
int main() {
  input();
  solve();
  output();
}
