You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
361 B
C++

#include <cstdio>
#include <algorithm>
using namespace std;
int a[110],n,x;
int main()
{
while(scanf("%d%d",&n,&x),n|x)
{
for(int i=0; i<n; i++)
scanf("%d",a+i);
a[n]=x;
sort(a,a+n+1);
for(int i=0; i<n; i++)
printf("%d ",a[i]);
printf("%d\n",a[n]);
}
return 0;
}