#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>, int> > v;
vector<pair<pair<int, int>, int> > s;
pair<pair<int, int>, int> t;
char F[300000];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    v.push_back(make_pair(make_pair(x, -(x + y - 1)), i));
  }
  sort(v.begin(), v.end());
  int lt = -1, ans = 0;
  for (int i = 0; i < m; i++) {
    if (-v[i].first.second > lt) {
      while (s.size() > 1 &&
             -s[s.size() - 2].first.second >= v[i].first.first - 1)
        s.pop_back();
      lt = -v[i].first.second;
      s.push_back(v[i]);
    }
  }
  for (int i = 0; i < (int)s.size(); i++) {
    ++ans;
    F[s[i].second] = 1;
  }
  printf("%d\n", m - ans);
  for (int i = 0; i < m; i++)
    if (!F[i]) printf("%d ", i + 1);
  return 0;
}
