#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 6;
int cnt1[MAX_N];
int cnt2[2 * MAX_N];
int ans[MAX_N];
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    memset(cnt1, 0, sizeof(cnt1));
    memset(cnt2, 0, sizeof(cnt2));
    memset(ans, 0, sizeof(ans));
    for (int i = 1; n >= i; i++) {
      int t;
      scanf("%d", &t);
      cnt1[t]++;
    }
    for (int i = 1; n >= i; i++) {
      int t;
      scanf("%d", &t);
      cnt2[m - t - 1]++;
    }
    for (int i = 0; m > i; i++) {
      int tmp = min(cnt1[i], cnt2[i]);
      ans[m - 1] += tmp;
      cnt1[i] -= tmp;
      cnt2[i] -= tmp;
    }
    priority_queue<int> pq;
    for (int i = 0; m > i; i++) {
      for (int j = 0; cnt1[i] > j; j++) {
        pq.push(i);
      }
      while (cnt2[i] > 0 && !pq.empty()) {
        cnt2[i]--;
        int t = pq.top();
        pq.pop();
        ans[abs((m - i - 1 + t) % m)]++;
      }
    }
    for (int i = 0; m > i; i++) {
      cnt2[m + i] = cnt2[i];
    }
    for (int i = m; 2 * m > i; i++) {
      while (cnt2[i] > 0 && !pq.empty()) {
        cnt2[i]--;
        int t = pq.top();
        pq.pop();
        ans[abs((2 * m - i + t - m - 1))]++;
      }
    }
    bool check = false;
    for (int i = m - 1; i >= 0; i--) {
      while (ans[i]--) {
        if (check) printf(" ");
        check = true;
        printf("%d", i);
      }
    }
    puts("");
  }
}
