#include <bits/stdc++.h>
using namespace std;
int n, m, s[200005][3], ansn;
bool ans[200005];
int comp(const void *a, const void *b) {
  int *pa = (int *)a, *pb = (int *)b;
  if (pa[0] != pb[0])
    return pa[0] - pb[0];
  else
    return pa[1] - pb[1];
}
int main() {
  int i, ending, nowlong, nowk;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) scanf("%d%d", &s[i][0], &s[i][1]), s[i][2] = i + 1;
  qsort(s, m, sizeof(int) * 3, comp);
  memset(ans, 0, sizeof(ans));
  nowlong = ending = s[0][0] - 1;
  for (i = nowk = 0, ansn = m; i < m; i++) {
    if (s[i][0] - 1 <= ending) {
      if (s[i][0] + s[i][1] - 1 > nowlong)
        nowlong = s[i][0] + s[i][1] - 1, nowk = s[i][2];
    } else if (nowk != 0) {
      ending = nowlong;
      ans[nowk] = true;
      nowk = 0;
      ansn--;
      i--;
    } else
      nowlong = ending = s[i][0] - 1, i--;
  }
  if (nowk != 0) ans[nowk] = true, ansn--;
  printf("%d\n", ansn);
  for (i = 1; i <= m; i++)
    if (!ans[i]) printf("%d ", i);
  printf("\n");
  return 0;
}
