#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  int f = 0, c = getchar();
  x = 0;
  while (!isdigit(c)) f |= c == 45, c = getchar();
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (f) x = -x;
}
template <typename T, typename... Args>
inline void read(T &x, Args &...args) {
  read(x);
  read(args...);
}
namespace run {
const int maxn = 2e6 + 10, maxm = 2e5 + 10;
int d[maxn], pos[maxn], mx[maxn], ans[maxm];
bool vis[maxm];
int n, m, res, now, tmp, move;
inline int main() {
  read(n, m);
  for (register int i = 1, x, y; i <= m; ++i) {
    read(x, y);
    d[x]++;
    d[x + y]--;
    if (mx[x] < x + y - 1) mx[x] = x + y - 1, pos[x] = i;
  }
  for (register int i = 1; i <= n; ++i) d[i] += d[i - 1];
  for (register int i = 1; i <= n; ++i) {
    if (mx[i] > move) move = mx[i], tmp = pos[i];
    if (d[i] && now < i) now = move, vis[tmp] = true;
  }
  for (register int i = 1; i <= m; ++i)
    if (!vis[i]) ans[++res] = i;
  printf("%d\n", res);
  for (register int i = 1; i <= res; ++i)
    printf("%d%c", ans[i], i == res ? '\n' : ' ');
  return 0;
}
}  // namespace run
int main() { return run ::main(); }
