#include <bits/stdc++.h>
using namespace std;
class instruction {
 public:
  int begin;
  int end;
  instruction(int b, int e) : begin(b), end(e){};
  bool operator<(const instruction i) const {
    if (begin < i.begin)
      return true;
    else if (begin == i.begin) {
      if (end < i.end) return true;
    };
    return false;
  };
  bool operator>(const instruction i) const {
    if (begin > i.begin)
      return true;
    else if (begin == i.begin) {
      if (end > i.end) return true;
    };
    return false;
  };
  bool operator==(const instruction i) const {
    return begin == i.begin && end == i.end;
  };
};
int main(void) {
  int m, count;
  cin >> count >> m;
  vector<instruction> inst;
  vector<instruction> inst2;
  int b, e;
  for (int i = 0; i < m; i++) {
    cin >> b >> e;
    inst.push_back(*(new instruction(b, b + e - 1)));
    inst2.push_back(*(new instruction(b, b + e - 1)));
  }
  sort(inst.begin(), inst.end());
  vector<instruction>::iterator it = inst.begin();
  count = 0;
  set<instruction> ans;
  int maxSoFar = 0;
  int maxLoop;
  int maxCount;
  bool gap = false;
  while (it != inst.end()) {
    if (maxSoFar + 1 < it->begin) {
      maxSoFar = it->begin - 1;
      gap = true;
    }
    maxLoop = it->end;
    maxCount = count;
    while (it != inst.end()) {
      if (maxSoFar + 1 < it->begin) break;
      if (maxLoop < it->end) {
        maxLoop = it->end;
        maxCount = count;
      }
      it++;
      count++;
    }
    if (gap && maxLoop == maxSoFar) ans.insert(inst[maxCount]);
    if (maxLoop > maxSoFar) {
      maxSoFar = maxLoop;
      ans.insert(inst[maxCount]);
    }
    gap = false;
  }
  cout << m - ans.size() << endl;
  count = 0;
  set<instruction>::iterator it2;
  for (int i = 0; i < m; i++) {
    it2 = ans.find(inst2[i]);
    if (it2 == ans.end()) {
      cout << i + 1 << " ";
      count++;
      if (count == m - ans.size()) break;
      continue;
    }
    ans.erase(it2);
  }
  return 0;
}
