#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template using V=vector; template using VV=V>; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll n,x; cin>>n>>x; V A(n),B(n+1); rep(i,n){ cin>>A[i]; if(A[i]<=n) B[A[i]]++; } x--; set s; rep(i,n+1) if(B[i]==0) s.insert(i); if(x C(n+1); rep(i,n){ auto p=*s.begin(); s.erase(p); B[p]++; C[i]=p; if(A[i]<=n){ B[A[i]]--; if(B[A[i]]==0) s.insert(A[i]); } } C[n]=*s.begin(); cout<