#include <bits/stdc++.h>
using namespace std;
inline int Read() {
  char c = getchar();
  int num = 0;
  while ('0' > c || c > '9') c = getchar();
  while ('0' <= c && c <= '9') num = num * 10 + c - '0', c = getchar();
  return (num);
}
int n, m, ans, v[2000010];
pair<int, int> t[2000010 * 4];
inline void Add(int rt, int l, int r, int a, int b, pair<int, int> pr) {
  int mid = (l + r) / 2;
  if (l == a && r == b) {
    t[rt] = min(t[rt], pr);
    return;
  }
  if (b <= mid) Add(rt * 2, l, mid, a, b, pr);
  if (mid < a) Add(rt * 2 + 1, mid + 1, r, a, b, pr);
  if (a <= mid && mid < b)
    Add(rt * 2, l, mid, a, mid, pr),
        Add(rt * 2 + 1, mid + 1, r, mid + 1, b, pr);
}
inline pair<int, int> Ask(int rt, int l, int r, int a) {
  int mid = (l + r) / 2;
  if (l == r) return (t[rt]);
  if (a <= mid)
    return (min(t[rt], Ask(rt * 2, l, mid, a)));
  else
    return (min(t[rt], Ask(rt * 2 + 1, mid + 1, r, a)));
}
int main() {
  n = Read(), m = Read();
  for (int i = 1; i <= n * 4; i++) t[i] = make_pair(n + 1, 0);
  for (int i = 1; i <= m; i++) {
    int l = Read(), r = Read();
    Add(1, 1, n, l, l + r - 1, make_pair(l, i));
  }
  for (int i = n; i;) {
    pair<int, int> pr = Ask(1, 1, n, i);
    if (pr.first == n + 1) {
      i--;
      continue;
    }
    v[pr.second] = 1;
    i = pr.first - 1;
  }
  for (int i = 1; i <= m; i++)
    if (!v[i]) ans++;
  printf("%d\n", ans);
  for (int i = 1; i <= m; i++)
    if (!v[i]) printf("%d ", i);
  puts("");
}
