#include <bits/stdc++.h>
using namespace std;
int a[100007], b[100007];
vector<int> v, ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, x;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x, a[x]++;
  for (int i = 0; i < n; i++) cin >> x, b[m - x - 1]++;
  for (int x = 0; x < 2 * m; x++) {
    int i = x % m;
    while (a[i]) v.push_back(i), a[i]--;
    while (b[i] && v.size())
      ans.push_back((v.back() + m - i - 1) % m), v.pop_back(), b[i]--;
  }
  sort(ans.begin(), ans.end());
  for (long i = ans.size() - 1; i >= 0; i--) cout << ans[i] << ' ';
}
