#include <bits/stdc++.h>

#define f(i,a,b) for( ll i = a; i < b ; i++ )
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ones(ini) (ll) __builtin_popcountll(x)
#define revll greater<ll>
#define revii greater<ii>()
#define todo(y,val) all_of(all(y),[&val](ll x) {return (x == ((ll)val));})
#define nada(y,val) none_of(all(y),[&val](ll x) {return (x == ((ll)val));})
#define algu(y,val) any_of(all(y),[&val](ll x) {return (x == ((ll)val));})
#define cuantos(a,x) count(all(a),x)
#define fs first
#define sc second
#define pb push_back
#define po pop_back
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ller ios::sync_with_stdio(false);cin.tsie(nullptr);cout.tie(nullptr)
#define watch(x) cout << (#x) << " is " << (x) <<"\n"
#define test ll t;cin>>t;while(t--)
#define PI acos(-1);
using namespace std;
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> ii;
typedef vector<ll>  vi;
typedef vector<ii> vii;

const ll mod = 1e9+7;
const ll MAX = 1e5+12;
const ll inf = 1e18+3;

int main(){
  fastio;
  ll n,x;cin>>n>>x;
  vi v;
  f(i,0,n){
    ll lec;
    cin>>lec;
    if(lec==x) continue;
    v.pb(lec);
  }
  f(i,0,sz(v)){
    cout<<v[i]<<" ";
  }
  cout<<"\n";
  return 0;  
}
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <queue>
#include <map>
#include <iomanip>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}

int64_t gcd(int64_t a,int64_t b){
    if(a < b)
    {
        int64_t temp = a;
        a = b ;
        b = temp;
    }
    int64_t copya = a;
    int64_t copyb = b;
    int64_t r = a%b ;
    while (r != 0)
    {
        a = b ;
        b = r ;
        r = a%b ;
    }
    return b ;
    
}



int main(){
    int n,m ;
    cin >> n >> m ;
    vector<int> a(n) ;
    vector<int> b(m) ;
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    for (int i = 0; i < m; i++)
    {
        cin >> b.at(i) ;
    }
    a.push_back(1001) ;
    b.push_back(1001) ;
    int ai = 0 ;
    int bi = 0 ;
    vector<int> ans(0) ;
    while (ai < n || bi < m )
    {
        if (a.at(ai) < b.at(bi))
        {
            ans.push_back(a.at(ai)) ;
            ai ++ ;
        }else if (a.at(ai) > b.at(bi))
        {
            ans.push_back(b.at(bi)) ;
            bi ++ ;
        }else
        {
            ai ++ ;
            bi ++ ;
        }
        
        
        
    }
    if (ans.size() == 0)
    {
        return 0 ;
    }
    
    for (int i = 0; i < ans.size() - 1 ; i++)
    {
        cout << ans.at(i) << " " ;
    }
    cout << ans.at(ans.size()-1) << endl ;
    
}
