#include <bits/stdc++.h>
using namespace std;
struct node {
  int s;
  int e;
  int i;
};
node a[200010];
bool cmp(node x, node y) { return ((x.s < y.s) || (x.s == y.s && x.e < y.e)); }
int main() {
  int n, m, i, j, l, r, pr;
  cin >> n >> m;
  for (i = 1; i <= m; i++) {
    cin >> l >> r;
    r = l + r - 1;
    a[i].i = i;
    a[i].s = l;
    a[i].e = r;
  }
  sort(a + 1, a + m + 1, cmp);
  vector<int> ans, v, b;
  for (i = m; i >= 1;) {
    v.push_back(i);
    j = i - 1;
    while (j >= 1 && a[j].s == a[i].s) {
      ans.push_back(a[j].i);
      j--;
    }
    i = j;
  }
  l = 1000000000, r = -1;
  for (j = v.size() - 1; j >= 0; j = i) {
    l = min(a[v[j]].s, l);
    r = max(a[v[j]].e, r);
    b.push_back(v[j]);
    for (i = j - 1; i >= 0; i--) {
      if (a[v[i]].e > r) break;
      ans.push_back(a[v[i]].i);
    }
  }
  j = 1;
  pr = 0;
  int sz = b.size();
  for (; j <= (sz - 2); j++) {
    if (a[b[j + 1]].s <= (a[b[pr]].e + 1)) {
      ans.push_back(a[b[j]].i);
    } else {
      pr = j;
    }
  }
  cout << ans.size() << endl;
  for (i = 0; i < ans.size(); i++) cout << ans[i] << " ";
  return 0;
}
