#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char i = getchar();
  long long f = 1, sum = 0;
  while (i < '0' || i > '9') {
    if (i == '-') f = -1;
    i = getchar();
  }
  while (i >= '0' && i <= '9') {
    sum = sum * 10 + i - '0';
    i = getchar();
  }
  return sum * f;
}
const int N = 1e5 + 50;
const long long inf = 1e18 + 666666666;
long long n, m, p[N], a[N], num[N], nxt[N], pre[N];
set<pair<long long, long long> > vis;
set<pair<long long, long long> >::iterator ite;
long long dis(long long x, long long y) {
  if (x == y) return inf;
  long long d = (p[y] - p[x] + m) % m;
  if (x > y) d = (d + a[y]) % m;
  if (d <= a[x]) return 1;
  if (a[x] <= a[y]) return inf;
  long long s = a[x] - a[y];
  return (d - a[y] - 1) / s + 1;
}
bool cmp(long long x, long long y) { return p[x] < p[y]; }
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) {
    p[i] = read();
    a[i] = read();
    num[i] = i;
  }
  sort(num + 1, num + 1 + n, cmp);
  for (int i = 1; i <= n; ++i) {
    if (i < n)
      nxt[num[i]] = num[i + 1];
    else
      nxt[num[i]] = num[1];
    pre[nxt[num[i]]] = num[i];
  }
  for (int i = 1; i <= n; ++i) {
    vis.insert(make_pair(dis(i, nxt[i]), i));
  }
  while (!vis.empty()) {
    ite = vis.begin();
    if ((*ite).first == inf) break;
    long long id = (*ite).second;
    vis.erase(ite);
    vis.erase(make_pair(dis(nxt[id], nxt[nxt[id]]), nxt[id]));
    vis.erase(make_pair(dis(pre[id], id), pre[id]));
    p[id] += dis(id, nxt[id]);
    a[id]--;
    nxt[id] = nxt[nxt[id]];
    pre[nxt[id]] = id;
    vis.insert(make_pair(dis(pre[id], id), pre[id]));
    vis.insert(make_pair(dis(id, nxt[id]), id));
  }
  cout << vis.size() << endl;
  for (ite = vis.begin(); ite != vis.end(); ite++) {
    cout << (*ite).second << ' ';
  }
  return 0;
}
