#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, f, k, qwq, ans, qaq[2000005], a[2000005], b[2000005],
    siz[2000005], mx[2000005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a[i], &b[i]);
    b[i] += a[i];
    siz[a[i]]++;
    mx[a[i]] = max(mx[a[i]], b[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (qwq == 0) {
      while (siz[i] == 0) i++;
      qwq = 1;
    }
    qaq[i] = 1;
    ans++;
    r = mx[i];
    k = f = 0;
    for (int j = i + 1; j <= min(mx[i], n); j++)
      if (siz[j] && mx[j] > r) k = j, r = mx[j], f = 1;
    if (f)
      i = k - 1;
    else {
      i = mx[i] + 1;
      while (siz[i] == 0 && i <= n + 1) i++;
      i--;
    }
  }
  printf("%d\n", m - ans);
  for (int i = 1; i <= m; i++) {
    if (qaq[a[i]]) {
      if (b[i] != mx[a[i]])
        printf("%d ", i);
      else
        qaq[a[i]] = 0;
    } else
      printf("%d ", i);
  }
  return 0;
}
