#include <bits/stdc++.h>
using namespace std;
int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const int maxn = 2e6 + 10;
const int inf = 1e9;
int pref[maxn], t;
struct SEG {
  int l, r, id;
  inline bool operator<(const SEG &B) const {
    return make_pair(l, -r) < make_pair(B.l, -B.r);
  }
};
vector<SEG> seg;
vector<int> ans;
bool mark[maxn];
int32_t main() {
  int n = in(), m = in();
  for (int i = 0; i < m; i++) {
    int l = in(), r = l + in() - 1;
    seg.push_back({l, r, i});
    pref[l]++, pref[r + 1]--;
  }
  for (int i = 1; i < maxn; i++) pref[i] += pref[i - 1];
  sort(seg.begin(), seg.end());
  int cur = 0;
  int where = 1;
  while (where <= n && !pref[where]) where++;
  while (where <= n) {
    int id = -1;
    while (cur < m && seg[cur].l <= where) {
      if (id == -1 || seg[cur].r > seg[id].r) id = cur;
      cur++;
    }
    mark[seg[id].id] = true;
    where = seg[id].r + 1;
    while (where <= n && !pref[where]) where++;
  }
  for (auto x : seg)
    if (!mark[x.id]) ans.push_back(x.id);
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x + 1 << " ";
}
