#include <bits/stdc++.h>
using namespace std;
class Q {
 public:
  int a, b, n;
};
Q a[200000], td[200000];
int ntd = 0;
bool comp(Q a, Q b) { return (a.a < b.a) || (a.a == b.a && a.b > b.b); }
bool comp1(Q a, Q b) { return a.n < b.n; }
int main() {
  int n, m, q1, q2;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> q1 >> q2;
    a[i].a = q1;
    a[i].b = q2 + q1;
    a[i].n = i;
  }
  sort(a, a + m, comp);
  int last = 0, nrem = -1;
  for (int i = 0; i < m; ++i)
    if (a[i].a > last)
      if (nrem == -1)
        last = a[i].b;
      else {
        last = a[nrem].b;
        nrem = -1;
        --i;
        continue;
      }
    else if (a[i].b > last)
      if (nrem == -1)
        nrem = i;
      else if (a[i].b > a[nrem].b) {
        td[ntd++] = a[nrem];
        nrem = i;
      } else
        td[ntd++] = a[i];
    else
      td[ntd++] = a[i];
  if (nrem != -1 && a[nrem].b <= last) td[ntd++] = a[nrem];
  sort(td, td + ntd, comp1);
  printf("%d\n", ntd);
  for (int i = 0; i < ntd; ++i) printf("%d ", td[i].n + 1);
  return 0;
}
