#include <bits/stdc++.h>
using namespace std;
struct otr {
  int a, b, c;
};
bool cmp(otr &a, otr &b) {
  if (a.a != b.a) return a.a < b.a;
  if (a.b != b.b) return a.b > b.b;
  return a.c < b.c;
}
bool used[222222];
int i, j, maxx;
otr v[222222];
int main() {
  int n, m;
  scanf("%d%d", &m, &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &v[i].a, &v[i].b);
    v[i].b += v[i].a - 1;
    v[i].c = i;
  }
  sort(v + 1, v + n + 1, cmp);
  int l = 0;
  int r = 0;
  int posmax;
  i = 1;
  j = 1;
  while (i <= n) {
    if (v[i].a > r) {
      used[i] = true;
      r = v[i].b;
      i++;
    } else {
      while (j <= n && v[j].a <= r + 1) {
        if (v[j].b > maxx) {
          maxx = v[j].b;
          posmax = j;
        }
        j++;
      }
      used[posmax] = true;
      i = j;
      r = maxx;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (!used[i]) ans++;
  cout << ans << endl;
  for (int i = 1; i <= n; i++)
    if (!used[i]) printf("%d ", v[i].c);
  return 0;
}
