#include <bits/stdc++.h>
using namespace std;
int n, m;
struct node {
  int l, r, id;
} a[2000005];
bool cmp(const node &a, const node &b) {
  return a.l == b.l ? a.r > b.r : a.l < b.l;
}
int cnt, y;
stack<int> s;
bool flag[2000005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x; i <= m; ++i) {
    scanf("%d%d", &a[i].l, &x);
    a[i].r = a[i].l + x - 1;
    a[i].id = i;
  }
  sort(a + 1, a + m + 1, cmp);
  for (int i = 1; i <= m; ++i) {
    if (s.empty()) {
      s.push(i);
      flag[i] = 1;
      ++cnt;
      continue;
    }
    if (a[i].r <= a[s.top()].r) continue;
    int tmp = s.top();
    s.pop();
    while (!s.empty() && a[i].l - a[s.top()].r <= 1) {
      --cnt;
      flag[tmp] = 0;
      tmp = s.top();
      s.pop();
    }
    s.push(tmp);
    s.push(i);
    flag[i] = 1;
    ++cnt;
  }
  printf("%d\n", m - cnt);
  priority_queue<int, vector<int>, greater<int> > q2;
  for (int i = 1; i <= m; ++i)
    if (!flag[i]) q2.push(a[i].id);
  while (!q2.empty()) {
    printf("%d ", q2.top());
    q2.pop();
  }
  return 0;
}
