#include <bits/stdc++.h>
using namespace std;
const int N_ = 2000003;
const int M_ = 200005;
int mark[N_ + 1];
typedef struct {
  int l, r;
  int no;
} M;
M M_array[M_ + 1];
bool cmp(const M &a, const M &b) {
  if (a.l != b.l) return a.l < b.l;
  return a.r > b.r;
}
int PreTreatment(int n, int m) {
  int r, l, newN;
  memset(mark, 0, sizeof(mark));
  for (int i = 0; i < m; i++) {
    l = M_array[i].l;
    r = M_array[i].r;
    if (!mark[r])
      for (int j = l; j < r + 1; j++) mark[j] = 1;
  }
  newN = 1;
  for (int i = 1; i <= n; i++) {
    if (mark[i]) mark[i] = newN++;
  }
  for (int i = 0; i < m; i++) {
    M_array[i].l = mark[M_array[i].l];
    M_array[i].r = mark[M_array[i].r];
  }
  return newN - 1;
}
int main() {
  int n, m, newN;
  int a, r, l, cnt, NowL, MaxR, e;
  while (cin >> n >> m) {
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &a, &l);
      M_array[i].l = a;
      M_array[i].r = a + l - 1;
      M_array[i].no = i + 1;
    }
    sort(M_array, M_array + m, cmp);
    newN = PreTreatment(n, m);
    sort(M_array, M_array + m, cmp);
    cnt = 0;
    NowL = 0;
    memset(mark, 0, sizeof(mark));
    e = 0;
    for (int i = 0; i < m; i = e + 1) {
      if (NowL == newN) break;
      l = M_array[i].l;
      r = M_array[i].r;
      if (i == 0) {
        NowL = r;
        mark[cnt++] = M_array[i].no;
        continue;
      }
      MaxR = r;
      e = i;
      for (int j = i + 1; j < m; j++) {
        l = M_array[j].l;
        r = M_array[j].r;
        if (l > NowL + 1) break;
        if (r > MaxR) {
          MaxR = r;
          e = j;
        }
      }
      mark[cnt++] = M_array[e].no;
      NowL = M_array[e].r;
    }
    sort(mark, mark + cnt);
    cout << m - cnt << endl;
    if (n > cnt) {
      int t = 0;
      bool f = true;
      for (int i = 1; i <= m; i++) {
        if (i != mark[t]) {
          if (f) {
            cout << i;
            f = false;
          } else
            cout << " " << i;
        } else
          t++;
      }
      cout << endl;
    }
  }
  return 0;
}
