#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 50;
inline int read() {
  int s = 0, w = 1, ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + ch - 48;
    ch = getchar();
  }
  return s * w;
}
struct node {
  int l, r, id;
  bool operator<(node a) const { return l < a.l; }
} a[maxn];
int n, m;
bool bj[maxn];
int ch[maxn];
priority_queue<pair<int, int> > q;
inline int lowbit(int x) { return x & -x; }
void add(int i, int x) {
  while (i <= n) {
    ch[i] += x;
    i += lowbit(i);
  }
}
int sum(int i) {
  int res = 0;
  while (i) {
    res += ch[i];
    i -= lowbit(i);
  }
  return res;
}
signed main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    a[i].l = read();
    a[i].r = read() + a[i].l - 1;
    a[i].id = i;
    add(a[i].l, 1);
    add(a[i].r + 1, -1);
  }
  sort(a + 1, a + 1 + m);
  int tp = 1, las = 0;
  for (int i = 1; i <= n; i++) {
    while (a[tp].l <= i && tp <= m) q.push(make_pair(a[tp].r, a[tp].id)), tp++;
    if (i > las && sum(i)) {
      las = q.top().first;
      bj[q.top().second] = 1;
      q.pop();
    }
  }
  int ans = 0;
  for (int i = 1; i <= m; i++) ans += 1 - bj[i];
  cout << ans << endl;
  for (int i = 1; i <= m; i++)
    if (bj[i] == 0) printf("%d ", i);
  return 0;
}
