#include <bits/stdc++.h>
using namespace std;
const int MAX = 200 * 1000 + 1;
struct Seg {
  int s, e, Id;
  friend bool operator<(Seg a, Seg b) { return a.s < b.s; }
  friend bool operator>(Seg a, Seg b) {
    return (a.e != b.e ? a.e > b.e : a.Id > b.Id);
  }
} a[MAX + 10];
set<Seg, greater<Seg> > s;
bool mrk[MAX + 10];
int cnt = 0;
int n, m;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++)
    cin >> a[i].s >> a[i].e, a[i].Id = i, a[i].e += a[i].s;
  sort(a, a + m);
  int p = 0;
  int next = 0;
  for (int i = 1; i <= n; i++) {
    while (p < m && a[p].s == i) s.insert(a[p++]);
    if (next <= i && !s.empty() && s.begin()->e > i) {
      mrk[s.begin()->Id] = true;
      next = s.begin()->e;
      s.erase(s.begin());
      cnt++;
    }
  }
  cout << m - cnt << endl;
  for (int i = 0; i < m; i++)
    if (!mrk[i]) cout << i + 1 << " ";
  cout << endl;
  return 0;
}
