#include <bits/stdc++.h>
using namespace std;
int n, m, num, cnt;
int data[3][100005];
inline int trans(int x) { return (m - 1 - x + m) % m; }
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(data, 0, sizeof(data));
    for (int k = 0; k < 2; ++k) {
      for (int i = 0; i < n; ++i) {
        scanf("%d", &num);
        data[k][num]++;
      }
    }
    stack<pair<int, int> > s;
    for (int k = 0; k < 2; ++k) {
      for (int i = 0; i < m; ++i) {
        if (data[0][i] != 0) {
          s.push(pair<int, int>(i, data[0][i]));
          data[0][i] = 0;
        }
        while (data[1][trans(i)] && !s.empty()) {
          num = s.top().first;
          cnt = s.top().second;
          if (cnt <= data[1][trans(i)]) {
            data[1][trans(i)] -= cnt;
            data[2][(num + trans(i)) % m] += cnt;
            s.pop();
          } else {
            data[2][(num + trans(i)) % m] += data[1][trans(i)];
            s.pop();
            s.push(pair<int, int>(num, cnt - data[1][trans(i)]));
            data[1][trans(i)] = 0;
          }
        }
      }
    }
    for (int i = m - 1; i >= 0; --i) {
      for (int j = 0; j < data[2][i]; ++j) printf("%d ", i);
    }
    puts("");
  }
}
