#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000000 + 100;
struct Line {
  int x, y, id;
  bool operator<(const Line& obj) const {
    return (x < obj.x || x == obj.x && y < obj.y);
  }
} ans[MAXN], p[MAXN];
bool need[MAXN];
int top, n, m;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &p[i].x, &p[i].y);
    p[i].y = p[i].x + p[i].y - 1;
    p[i].id = i;
    need[i] = true;
  }
  sort(p, p + m);
  ans[++top] = p[0];
  for (int i = 1; i < m; ++i) {
    if (p[i].y <= ans[top].y) {
      need[p[i].id] = false;
      continue;
    }
    while (top >= 1) {
      if (ans[top].x == p[i].x) {
        need[ans[top].id] = false;
        top--;
      } else
        break;
    }
    while (top >= 2) {
      if (ans[top - 1].y + 1 >= p[i].x) {
        need[ans[top].id] = false;
        top--;
      } else
        break;
    }
    ans[++top] = p[i];
  }
  cout << m - top << endl;
  for (int i = 0; i < m; ++i)
    if (!need[i]) printf("%d ", i + 1);
  return 0;
}
