#include <bits/stdc++.h>
using namespace std;
int a[101000];
int b[101000];
pair<int, int> all[301000];
int allc;
vector<int> ans;
inline bool cmp(int a, int b) { return a > b; }
int stk[301000], sc;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); i++) {
    scanf("%d", &a[i]);
    all[allc++] = make_pair(a[i], 0);
  }
  for (int i = 0; i < (n); i++) {
    scanf("%d", &b[i]);
    all[allc++] = make_pair(m - 1 - b[i], 1);
  }
  sort(all, all + allc);
  for (int i = 0; i < (allc); i++) {
    if (all[i].second) {
      if (sc == 0)
        all[allc++] = all[i];
      else {
        ans.push_back((all[stk[sc - 1]].first + m - 1 - all[i].first) % m);
        sc--;
      }
    } else {
      stk[sc++] = i;
    }
  }
  sort(ans.begin(), ans.end(), cmp);
  for (int i = 0; i < (((int)(ans).size())); i++)
    printf("%d%c", ans[i], ((i == ((int)(ans).size()) - 1) ? '\n' : ' '));
}
