#include <bits/stdc++.h>
using namespace std;
const long long linf = 1e18 + 5;
const int mod = (int)1e9 + 7;
const int logN = 17;
const int inf = 1e9;
const int N = 2e5 + 5;
int n, m, a[N], b[N], x, y, z, t;
vector<int> ans;
multiset<int> S;
int find(int xx) {
  int t1 = *S.rbegin();
  multiset<int>::iterator it = S.lower_bound(m - xx);
  if (it == S.begin()) return t1;
  it--;
  int t2 = *it;
  if ((xx + t1) % m > (xx + t2) % m) return t1;
  return t2;
}
int main() {
  srand(time(0));
  priority_queue<pair<int, pair<int, int> > > q;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    S.insert(b[i]);
  }
  for (int i = 1; i <= n; i++) {
    int t = find(a[i]);
    q.push(make_pair((t + a[i]) % m, make_pair(a[i], t)));
  }
  while (!q.empty()) {
    int xx = q.top().second.first;
    int yy = q.top().second.second;
    q.pop();
    if (find(xx) != yy) {
      int t = find(xx);
      q.push(make_pair((t + xx) % m, make_pair(xx, t)));
      continue;
    }
    ans.push_back((xx + yy) % m);
    S.erase(S.find(yy));
  }
  for (int i = 0; i <= n - 1; i++) printf("%d ", ans[i]);
  cout << '\n';
  return 0;
}
