#include <bits/stdc++.h>
using namespace std;
const int MAX = 500010;
int N, M, des[MAX];
struct Seg {
  int st, ed, id;
} seg[MAX];
bool cmp(Seg a, Seg b) { return a.st < b.st || (a.st == b.st && a.ed > b.ed); }
int main(void) {
  scanf("%d%d", &N, &M);
  for (int i = 0; i < M; i++) {
    scanf("%d%d", &seg[i].st, &seg[i].ed);
    seg[i].ed += seg[i].st, seg[i].id = i + 1;
  }
  sort(seg, seg + M, cmp);
  int cnt = 0, e, i, j, ma;
  for (i = j = 1; i < M; i++) {
    if (seg[i].ed <= seg[j - 1].ed)
      des[cnt++] = seg[i].id;
    else
      seg[j++] = seg[i];
  }
  seg[j].st = seg[j].ed = N + 10, j++;
  e = ma = 0;
  for (i = 1; i < j; i++) {
    if (seg[i].st > seg[e].ed) {
      for (int k = e + 1; k < i - 1; k++) des[cnt++] = seg[k].id;
      if (e == i - 1)
        e = i;
      else
        e = i - 1;
    }
  }
  if (cnt == 0) {
    printf("0\n");
    return 0;
  }
  sort(des, des + cnt);
  printf("%d\n", cnt);
  for (int i = 0; i < cnt - 1; i++) printf("%d ", des[i]);
  printf("%d\n", des[cnt - 1]);
  return 0;
}
