Shared Memory Switch

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Your task is to build an optimal algorithm for the shared memory switch.

A shared memory switch is one of the simplest nontrivial buffering architectures considered in the field of algorithms for networking. In this problem we consider a shared memory switch with multiple output queues and uniform (identical) packets. Incoming packets in this model are destined to one of the several output queues, which share a common buffer of finite size BB. At the end of each second all nonempty queues transmit one packet each. When the buffer overflows your algorithm must decide which packet to drop. Your goal is to design an algorithm achieving maximal throughput (equivalently, dropping as few packets as possible).

You will be given nn queries in the following format:

  • 1-1: a single second passes.
  • kk (1kn1 \leq k \leq n): a packet arrives to the kk-th queue.

You can assume that all packets remaining in the buffer after all queries will be sent as well or, equivalently, that there is an infinite number of 1-1 queries that follow the queries in the input.

입력

The first line contains contains two non-negative integers nn and BB (n,B2105n, B \leq 2 \cdot 10^5): the number of queries and the amount of memory available to the switch correspondingly.

The second line contains nn queries in the format described above.

출력

On the first line, output the only integer: the number of transmitted packets.

On the second line, output the numbers of queries (11-based) with arrivals of the packets that were transmitted. You can output these numbers in any order.