#include <bits/stdc++.h>   const double pi = 3.141592653589793238462;   const double eps = 1e-10;   using namespace std;   const int maxn = 100010;   int c[maxn];   multiset<int> a;   multiset<int> b;   multiset<int>::iterator setfloor(int val) {     multiset<int>::iterator it = b.upper_bound(val);     if (it == b.begin()) it = b.end();     it--;     return it;   }   int main() {     int i, j, k, n, m, tc, cnt;     ios_base::sync_with_stdio(false);     cin >> n >> m;     for (i = 0; i < n; i++) {       cin >> j;       a.insert(j);     }     for (i = 0; i < n; i++) {       cin >> j;       b.insert(j);     }     multiset<int>::iterator ita = --a.end();     multiset<int>::iterator itb, tmp1, tmp2;     cnt = 0;     int prev;     for (i = 0; i < n; i++) {       itb = setfloor(m - 1 - *ita);       if (itb != b.end() && *itb <= m - 1 - *ita) {         c[cnt++] = (*ita + *itb) % m;         tmp1 = ita;         ita--;         a.erase(tmp1);         b.erase(itb);       } else         ita--;     }     ita = a.end();     itb = b.end();     while (cnt < n) {       ita--;       itb--;       c[cnt++] = (*ita + *itb) % m;     }     sort(c, c + cnt);     for (i = cnt - 1; i >= 0; i--) cout << c[i] <<    ;     cout << endl;     return 0;   }   