public static void main(String args[]) {
        Scanner in = new Scanner(System.in);

        List<Integer> line = new ArrayList<Integer>(Arrays.asList(in.nextInt()));
        int n = in.nextInt();
        for (int i = 1; i < n; i++) {
            List<Integer> nextLine = new ArrayList<Integer>();

            int currentNumber = line.remove(0);
            int occur = 1;

            while (!line.isEmpty()) {
                int nextNumber = line.remove(0);
                if (nextNumber != currentNumber) {
                    nextLine.add(occur);
                    nextLine.add(currentNumber);
                    currentNumber = nextNumber;
                    occur = 1;
                } else {
                    occur++;
                }
            }
            nextLine.add(occur);
            nextLine.add(currentNumber);
            line = nextLine;
        }

        boolean first = true;
        for (int number : line) {
            if (!first) {
                System.out.print(" ");
            }
            first = false;
            System.out.print(number);
        }
    }