#include <bits/stdc++.h>
using namespace std;
bitset<2 * 1000000 + 1> flag;
struct Ln {
  int left, right;
  int sequence;
};
bool check(int i, int j) {
  bool fl = true;
  for (int k = i; k <= j; k++)
    if (!flag[k]) fl = false, flag.set(k);
  return fl;
}
bool comp(Ln a, Ln b) {
  if (a.left == b.left)
    return a.right > b.right;
  else
    return a.left < b.left;
}
int main() {
  int ByteNum, Instruction;
  cin >> ByteNum >> Instruction;
  vector<int> result;
  vector<Ln> Data(Instruction + 1);
  vector<Ln> Back;
  flag.reset();
  for (int i = 0; i < Instruction; i++) {
    cin >> Data[i + 1].left >> Data[i + 1].right;
    Data[i + 1].right += Data[i + 1].left - 1;
    if (Data[i + 1].right > ByteNum) Data[i + 1].right = ByteNum;
    Data[i + 1].sequence = i + 1;
  }
  sort(Data.begin() + 1, Data.end(), comp);
  int nright = 0;
  for (int i = 0; i < Instruction; i++)
    if (Data[i + 1].right <= nright)
      result.push_back(Data[i + 1].sequence);
    else
      nright = Data[i + 1].right, Back.push_back(Data[i + 1]);
  nright = 0;
  for (unsigned int i = 0; i < Back.size(); i++)
    if ((i + 1 < Back.size()))
      if (Back[i + 1].left - 1 <= nright)
        result.push_back(Back[i].sequence);
      else
        nright = Back[i].right;
  cout << result.size() << endl;
  for (unsigned i = 0; i < result.size(); i++) cout << result[i] << " ";
  return 0;
}
