#include <bits/stdc++.h>
using namespace std;
int N, M;
int A[100004];
int B[100004];
int freqA[100004];
int freqB[100004];
set<int, greater<int> > S;
vector<pair<int, int> > P[100004];
int next(int x) {
  int res = *S.begin();
  set<int, greater<int> >::const_iterator it = S.upper_bound(M - x);
  if (it != S.end()) {
    if ((*it + x) % M > (res + x) % M) res = *it;
  }
  return res;
}
int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> M;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    ++freqA[A[i]];
  }
  for (int i = 0; i < N; ++i) {
    cin >> B[i];
    ++freqB[B[i]];
    S.insert(B[i]);
  }
  for (int i = 0; i < N; ++i) {
    int nxt = next(A[i]);
    P[(nxt + A[i]) % M].push_back(pair<int, int>(A[i], nxt));
  }
  vector<int> R;
  for (int m = M - 1; m >= 0; --m) {
    for (int j = 0; j < P[m].size(); ++j) {
      pair<int, int> cur = P[m][j];
      int mn = min(freqA[cur.first], freqB[cur.second]);
      if (mn == 0) {
        if (freqA[cur.first] > 0) {
          int nxt = next(cur.first);
          P[(cur.first + nxt) % M].push_back(pair<int, int>(cur.first, nxt));
        }
        continue;
      }
      R.insert(R.end(), mn, m);
      freqA[cur.first] -= mn;
      freqB[cur.second] -= mn;
      if (freqB[cur.second] == 0) {
        S.erase(cur.second);
        if (freqA[cur.first] > 0) {
          int nxt = next(cur.first);
          P[(cur.first + nxt) % M].push_back(pair<int, int>(cur.first, nxt));
        }
      }
    }
    P[m].clear();
  }
  for (int i = 0; i < R.size(); ++i) cout << R[i] << ' ';
  cout << endl;
  return 0;
}
