|
@@ -0,0 +1,27 @@
|
|
|
+import java.util.Scanner;
|
|
|
+
|
|
|
+public class H {
|
|
|
+ public static void main(String[] args) {
|
|
|
+ while (cin.hasNext()) {
|
|
|
+ int n = cin.nextInt();
|
|
|
+ int[] a = new int[n + 1];
|
|
|
+ int x = cin.nextInt();
|
|
|
+ a[n] = x;
|
|
|
+ if (n == 0 && x == 0) break;
|
|
|
+ for (int i = 0; i < n; i++) a[i] = cin.nextInt();
|
|
|
+ for (int i = a.length - 2; i >= 0; i--) {
|
|
|
+ if (a[i] < a[i + 1]) break;
|
|
|
+ int t = a[i];
|
|
|
+ a[i] = a[i + 1];
|
|
|
+ a[i + 1] = t;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < a.length; i++) {
|
|
|
+ System.out.print(a[i] + " ");
|
|
|
+ }
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+ cin.close();
|
|
|
+ }
|
|
|
+
|
|
|
+ static Scanner cin = new Scanner(System.in);
|
|
|
+}
|