Please subscribe to the official Codeforces channel in Telegram via the link: https://t.me/codeforces_official.
×

Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Optimizer

time limit per test

3 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputA process RAM is a sequence of bytes that are indexed from 1 to *n*. Polycarpus's program contains such instructions as "memset", that is, the operations of filling memory cells on a segment with some value. The details are: the code only contains *m* instructions that look like "set13 a_i l_i". Instruction *i* fills a continuous memory segment of length *l*_{i}, starting from cell number *a*_{i}, (that it cells with numbers *a*_{i}, *a*_{i} + 1, ..., *a*_{i + li - 1}) with values 13.

In Polycarpus's code, the optimizer's task is to remove the maximum number of instructions from his code in such a way that the remaining instructions set value 13 in all the memory bytes that got this value from the code before the optimization. Also, the value 13 should be set only in the memory bytes that got this value from the code before the optimization. Your task is to implement the optimizer for such program.

Input

The first line contains integers *n* and *m* (1 ≤ *n* ≤ 2·10^{6}, 1 ≤ *m* ≤ 2·10^{5}) — the number of bytes (memory cells) and the number of instructions in Polycarpus's code. Then *m* lines follow, each line contains a pair of integers *a*_{i}, *l*_{i} (1 ≤ *a*_{i} ≤ *n*, 1 ≤ *l*_{i} ≤ *n* - *a*_{i} + 1).

Output

Print in the first line the sought maximum number of instructions that can be removed from the code. In the second line print the numbers of the instructions. The instructions are numbered from 1 to *m* in the order they appeared in the input. If there are multiple solutions, print any of them.

Examples

Input

10 4

3 3

3 1

4 1

9 2

Output

2

2 3

Input

1 1

1 1

Output

0

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/10/2018 06:25:25 (d1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|