#include <bits/stdc++.h>
using namespace std;
bool my_cmp(const pair<pair<int, int>, int>& a,
            const pair<pair<int, int>, int>& b) {
  if (a.first.first == b.first.first)
    return a.first.second < b.first.second;
  else
    return a.first.first < b.first.first;
}
bool trivial(pair<int, int> x, pair<int, int> y) {
  return (x.first + x.second >= y.first + y.second);
}
bool overlap(pair<int, int> x, pair<int, int> y) {
  return (y.first <= x.first + x.second);
}
void printPair(pair<int, int> x) {}
int main() {
  int n, m;
  set<int> indices;
  vector<pair<pair<int, int>, int> > instructions;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    instructions.push_back(pair<pair<int, int>, int>(pair<int, int>(x, y), i));
    indices.insert(i);
  }
  sort(instructions.begin(), instructions.end(), my_cmp);
  int best = -1;
  int last = 0;
  while (last + 1 < instructions.size() &&
         instructions[last + 1].first.first == instructions[0].first.first)
    last++;
  indices.erase(instructions[last].second);
  for (int i = last; i < instructions.size(); i++) {
    pair<int, int> lastIns = instructions[last].first;
    pair<int, int> current = instructions[i].first;
    printPair(lastIns);
    printPair(current);
    if (trivial(lastIns, current)) continue;
    if (overlap(lastIns, current)) {
      int j = i + 1;
      int delta = current.first + current.second;
      int best = i;
      while (j < instructions.size() &&
             overlap(lastIns, instructions[j].first)) {
        int t = instructions[j].first.first + instructions[j].first.second;
        if (t > delta) {
          best = j;
          delta = t;
        }
        j++;
      }
      i = best;
      indices.erase(instructions[best].second);
      last = i;
      continue;
    } else {
      int j = i;
      while (j + 1 < instructions.size() &&
             instructions[j + 1].first.first == instructions[i].first.first)
        j++;
      i = j;
      indices.erase(instructions[i].second);
      last = i;
      continue;
    }
  }
  cout << indices.size() << endl;
  for (auto it = indices.begin(); it != indices.end(); it++)
    cout << (*it) + 1 << " ";
}
