#include <bits/stdc++.h>
using namespace std;
int ind[200010];
int ind2[200010];
int code[200010];
struct intervalo {
  int ini;
  int fim;
};
intervalo I[200010];
bool comp(int a, int b) {
  if (I[a].ini == I[b].ini) return I[a].fim > I[b].fim;
  return I[a].ini < I[b].ini;
}
int main() {
  int n;
  int m;
  int aux;
  int cont;
  int index;
  int max;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &I[i].ini, &I[i].fim);
    I[i].fim = I[i].fim + I[i].ini - 1;
    ind[i] = i;
  }
  sort(&ind[1], &ind[m + 1], comp);
  aux = I[ind[1]].fim;
  cont = 0;
  max = aux;
  index = -1;
  for (int i = 2; i <= m; i++) {
    if (I[ind[i]].ini <= aux + 1) {
      if (I[ind[i]].fim > max) {
        code[cont] = index;
        cont++;
        index = ind[i];
        max = I[ind[i]].fim;
      } else {
        code[cont] = ind[i];
        cont++;
      }
    } else {
      aux = max;
      index = -1;
      if (I[ind[i]].fim > max) {
        code[cont] = index;
        cont++;
        index = ind[i];
        max = I[ind[i]].fim;
      } else {
        code[cont] = ind[i];
        cont++;
      }
    }
  }
  sort(&code[0], &code[cont]);
  int aux2;
  aux2 = 0;
  while (code[aux2] == -1) {
    aux2++;
  }
  printf("%d\n", cont - aux2);
  for (int i = aux2; i < cont; i++) {
    printf("%d ", code[i]);
  }
  return 0;
}
