#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 10;
const long long Inf = 1e10;
const int P = 1e9 + 7;
const int N = 100005;
inline int IN() {
  int x = 0;
  int ch = 0, f = 0;
  for (ch = getchar(); ch != -1 && (ch < 48 || ch > 57); ch = getchar())
    f = (ch == '-');
  for (; ch >= 48 && ch <= 57; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return f ? (-x) : x;
}
int Pow(int x, int y, int p) {
  int a = 1;
  for (; y; y >>= 1, x = (long long)x * x % p)
    if (y & 1) a = (long long)a * x % p;
  return a;
}
int n, m, p[N], a[N], pre[N], nxt[N];
pair<int, int> b[N];
set<pair<int, int> > st;
int calc(int x, int y) {
  if (x == y) return inf;
  int u = p[x], v = p[y];
  if (x > y) v = (v + a[y]) % m;
  int d = (v + m - u) % m, cha = a[x] - a[y];
  if (d <= a[x]) return 1;
  if (a[x] <= a[y]) return inf;
  return (d - a[y] + cha - 1) / cha;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (int)(1); i <= (int)(n); i++) {
    scanf("%d%d", p + i, a + i);
    --p[i];
    b[i] = make_pair(p[i], i);
  }
  sort(b + 1, b + n + 1);
  for (int i = (int)(1); i <= (int)(n); i++)
    pre[b[i % n + 1].second] = b[i].second,
                  nxt[b[i].second] = b[i % n + 1].second;
  for (int i = (int)(1); i <= (int)(n); i++)
    st.insert(make_pair(calc(i, nxt[i]), i));
  while (st.size()) {
    int i = st.begin()->second;
    if (st.begin()->first == inf) break;
    st.erase(st.begin());
    st.erase(make_pair(calc(nxt[i], nxt[nxt[i]]), nxt[i]));
    st.erase(make_pair(calc(pre[i], i), pre[i]));
    p[i] += calc(i, nxt[i]), --a[i];
    nxt[i] = nxt[nxt[i]], pre[nxt[i]] = i;
    st.insert(make_pair(calc(pre[i], i), pre[i]));
    st.insert(make_pair(calc(i, nxt[i]), i));
  }
  printf("%d\n", (int)st.size());
  for (auto i : st) printf("%d ", i.second);
  return 0;
}
