#include <stdio.h>

int a[200010];

int main() {
  freopen("battle.in", "r", stdin);
  freopen("battle.out", "w", stdout);
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i=0;i<n;i++) scanf("%d", a+i);
  for (int i=0;i<k;i++) {
    for (int j=0;j<n-1;j++)
      if (a[j] > a[j+1]) {
        int tmp = a[j];
        a[j] = a[j+1];
        a[j+1] = tmp;
      }
  }
  for (int i=0;i<n-1;i++) printf("%d ", a[i]);
  printf("%d\n", a[n-1]);
  return 0;
}
