#include <bits/stdc++.h>
using namespace std;
long long int a[100005], b[100005], v[100005], cnt[100005], res[100005], len;
void solve() {
  long long int n, m;
  cin >> n >> m;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    a[x]++;
  }
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    b[x]++;
  }
  for (long long int i = 0; i < m; i++) {
    len++;
    v[len] = i, cnt[len] = a[i];
    long long int j = m - i - 1;
    while (len && b[j]) {
      if (b[j] >= cnt[len]) {
        b[j] -= cnt[len];
        res[(j + v[len]) % m] += cnt[len];
        len--;
      } else {
        cnt[len] -= b[j];
        res[(j + v[len]) % m] += b[j];
        b[j] = 0;
      }
    }
  }
  for (long long int i = m - 1; i >= 0; i--) {
    while (b[i]) {
      if (b[i] >= cnt[len]) {
        b[i] -= cnt[len];
        res[(i + v[len]) % m] += cnt[len];
        len--;
      } else {
        cnt[len] -= b[i];
        res[(i + v[len]) % m] += b[i];
        b[i] = 0;
      }
    }
  }
  for (long long int i = m - 1; i >= 0; i--)
    for (long long int j = 0; j < res[i]; j++) cout << i << " ";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int qc = 1;
  for (long long int i = 1; i <= qc; i++) solve();
}
