#include <bits/stdc++.h>
using namespace std;
struct pt {
  int x;
  int y;
  int pos;
};
pt a[222222];
bool cmp(pt a, pt b) { return (a.x < b.x) || (a.x == b.x && a.y > b.y); }
vector<int> p;
vector<pair<int, int> > ans;
int n, m, was[222222], mark[222222], l;
void solve() {
  for (int i = 1; i < ans.size() - 1; i++) {
    int f = ans[i].first, s = ans[i].second, ps = ans[i - 1].second,
        nf = ans[i + 1].first;
    if (f == ps && nf - f == 1) {
      l++;
      was[p[i]] = 0;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    a[i].y = a[i].x + a[i].y - 1;
    a[i].pos = i;
  }
  sort(a + 1, a + m + 1, cmp);
  int res = m;
  int i = 1, last = -1;
  while (i <= m) {
    int mx = last, ind = -1;
    while (i <= m && a[i].x <= last + 1) {
      if (a[i].y > mx) {
        mx = a[i].y;
        ind = i;
      }
      i++;
    }
    if (i <= m && mx == last) {
      ind = i;
      mx = a[i].y;
      i++;
    }
    if (ind == -1) break;
    last = mx;
    was[a[ind].pos] = 1;
    res--;
  }
  printf("%d\n", res);
  for (int i = 1; i <= m; i++)
    if (!was[i]) printf("%d ", i);
  return 0;
}
