#include <bits/stdc++.h>
using namespace std;
const int N = 100007;
int nums[2][N];
int ans[N];
int s1[N], s2[N];
int main() {
  int n, m;
  cin >> n >> m;
  int nid, i;
  int tmp;
  memset(nums, 0, sizeof(nums));
  for (nid = 0; nid < 2; ++nid) {
    for (i = 0; i < n; ++i) {
      cin >> tmp;
      nums[nid][tmp]++;
    }
  }
  int ansId = 0;
  int s1Top = 0, s2Top = 0;
  for (i = 0; i <= m; ++i) {
    int key = m - i - 1;
    while (nums[0][i]--) {
      s1[s1Top++] = i;
    }
    while (nums[1][key]--) {
      if (s1Top) {
        ans[ansId++] = s1[--s1Top] + key;
      } else {
        s2[s2Top++] = key;
      }
    }
  }
  s2Top = 0;
  while (s1Top) {
    ans[ansId++] = (s1[--s1Top] + s2[s2Top++]) % m;
  }
  sort(ans, ans + ansId);
  for (i = ansId - 1; i >= 1; --i) {
    cout << ans[i] << " ";
  }
  cout << ans[0] << endl;
  return 0;
}
