#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000 + 10;
vector<int> Ririchiyo;
int n, m, id[MAXN];
pair<int, int> a[MAXN];
bool used[MAXN];
bool cmp(int first, int second) {
  return make_pair(a[first].first, -a[first].second) <
         make_pair(a[second].first, -a[second].second);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    int first, second;
    scanf("%d%d", &first, &second);
    a[i] = make_pair(first, first + second - 1);
    id[i] = i;
  }
  sort(id + 1, id + m + 1, cmp);
  int r = 0, p = 0;
  for (int i = 1; i <= m; ++i)
    if (a[id[i]].first - 1 <= r) {
      if (a[id[i]].second > a[p].second) {
        p = id[i];
      }
    } else {
      if (p) used[p] = 1;
      r = a[p].second;
      if (a[id[i]].second > r) p = id[i];
      if (r < a[id[i]].first) used[id[i]] = 1, r = a[id[i]].second;
    }
  if (a[p].second > r) used[p] = 1;
  for (int i = 1; i <= m; ++i)
    if (!used[i]) Ririchiyo.push_back(i);
  cout << Ririchiyo.size() << endl;
  for (int i = 0; i < (int)Ririchiyo.size(); ++i) cout << Ririchiyo[i] << " ";
  cout << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
