#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = 2e6 + 10;
int i, j, k, m, n, s, t;
struct fu {
  int l, r, rk;
} a[N];
int p[N];
bool cmp(fu aa, fu bb) { return aa.l < bb.l; }
int main() {
  read(n), read(m);
  for (i = 1; i <= m; i++) {
    read(a[i].l);
    read(a[i].r);
    a[i].rk = i;
    a[i].r += a[i].l - 1;
  }
  sort(a + 1, a + m + 1, cmp);
  int now = 0, maxn, maxm, ans = 0;
  i = 1;
  while (now < n) {
    maxn = now;
    while (a[i].l <= now + 1 && i <= m) {
      if (a[i].r > maxn) {
        maxn = a[i].r;
        maxm = i;
      }
      i++;
    }
    if (now == maxn)
      now++;
    else {
      now = maxn;
      p[a[maxm].rk] = 1;
      ans++;
    }
  }
  printf("%d\n", m - ans);
  for (i = 1; i <= m; i++)
    if (p[i] == 0) printf("%d ", i);
  return 0;
}
