#include <bits/stdc++.h>
using namespace std;
struct {
  int a, l, status;
} q[1000000];
bool cmp(const int &i, const int &j) {
  return q[i].a < q[j].a || (q[i].a == q[j].a && q[i].l < q[j].l);
}
int n, m;
int id[1000000];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &q[i].a, &q[i].l);
    id[i] = i;
    q[i].status = 0;
  }
  sort(id, id + m, cmp);
  int j = 0, rmax = 0, cnt = m;
  for (int i = 1; i <= n; ++i) {
    int pos = -1;
    while (j < m && q[id[j]].a <= i) {
      int r = q[id[j]].a + q[id[j]].l - 1;
      if (r > rmax) {
        pos = id[j];
        rmax = r;
      }
      j++;
    }
    if (pos != -1) {
      cnt--;
      q[pos].status = 1;
      i = rmax;
    }
  }
  printf("%d\n", cnt);
  for (int i = 0; i < m; ++i)
    if (!q[i].status) printf("%d ", i + 1);
  return 0;
}
