#include <bits/stdc++.h>
using namespace std;
int m, n, ll[200005], rr[200005], Index[200005];
bool Useful[200005];
bool cmp(int x, int y) { return ll[x] < ll[y]; }
bool maximize(int &a, int b) {
  if (a < b)
    a = b;
  else
    return false;
  return true;
}
int main() {
  scanf("%d%d", &m, &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &ll[i], &rr[i]);
  for (int i = 1; i <= n; i++) Index[i] = i, rr[i] += ll[i] - 1;
  sort(Index + 1, Index + n + 1, cmp);
  int pos = 1, Accepted = 1, Answer = n;
  while (pos <= n) {
    int Current = Accepted - 1, d = 0;
    while (pos <= n && ll[Index[pos]] <= Accepted) {
      if (maximize(Current, rr[Index[pos]])) d = Index[pos];
      pos++;
    }
    if (d != 0) {
      Useful[d] = true, Answer--;
    }
    Accepted = max(Current + 1, Accepted + 1);
  }
  cout << Answer << endl;
  for (int i = 1; i <= n; i++)
    if (!Useful[i]) printf("%d ", i);
  printf("\n");
}
