#include <bits/stdc++.h>
using namespace std;
const int MAX_M = 200000;
struct Instruction {
  int start, finish;
  int index;
  Instruction(int start, int finish, int index) {
    this->start = start;
    this->finish = finish;
    this->index = index;
  }
  bool operator<(const Instruction &other) const {
    if (start != other.start) return start < other.start;
    return finish > other.finish;
  }
};
int n, m;
vector<Instruction> v;
void read() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int start, len;
    cin >> start >> len;
    v.push_back(Instruction(start, start + len - 1, i + 1));
  }
}
void solve() {
  vector<int> remove;
  sort(v.begin(), v.end());
  vector<Instruction> new_v;
  int right_end = 0;
  for (typeof((v).begin()) it = (v).begin(); it != (v).end(); ++it)
    if (it->finish <= right_end)
      remove.push_back(it->index);
    else {
      right_end = it->finish;
      new_v.push_back(*it);
    }
  v = new_v;
  new_v.clear();
  int i = 0;
  while (i < static_cast<int>(v.size())) {
    int j = i + 1;
    while (j + 1 < static_cast<int>(v.size()) &&
           v[j + 1].start <= v[i].finish + 1) {
      remove.push_back(v[j].index);
      ++j;
    }
    i = j;
  }
  cout << remove.size() << "\n";
  for (typeof((remove).begin()) it = (remove).begin(); it != (remove).end();
       ++it)
    cout << *it << " ";
}
int main() {
  read();
  solve();
}
