#include <bits/stdc++.h>
using namespace std;
long long n, m, p[100010], a[100010], x[100010], Next[100010], Prev[100010];
set<pair<long long, long long> > Set;
inline long long read() {
  long long tmp = 1, x = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') tmp = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  return tmp * x;
}
long long dis(long long x, long long y) {
  if (x == y) return 2147483647;
  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 2147483647;
  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]; }
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) {
    p[i] = read();
    a[i] = read();
    x[i] = i;
  }
  sort(x + 1, x + 1 + n, cmp);
  for (long long i = 1; i <= n; i++) {
    if (i < n)
      Next[x[i]] = x[i + 1];
    else
      Next[x[i]] = x[1];
    Prev[Next[x[i]]] = x[i];
  }
  for (long long i = 1; i <= n; i++) Set.insert(make_pair(dis(i, Next[i]), i));
  while (!Set.empty()) {
    set<pair<long long, long long> >::iterator it = Set.begin();
    if ((*it).first == 2147483647) break;
    long long i = (*it).second;
    Set.erase(it);
    Set.erase(make_pair(dis(Next[i], Next[Next[i]]), Next[i]));
    Set.erase(make_pair(dis(Prev[i], i), Prev[i]));
    p[i] += dis(i, Next[i]);
    a[i]--;
    Next[i] = Next[Next[i]];
    Prev[Next[i]] = i;
    Set.insert(make_pair(dis(Prev[i], i), Prev[i]));
    Set.insert(make_pair(dis(i, Next[i]), i));
  }
  cout << Set.size() << endl;
  for (set<pair<long long, long long> >::iterator it = Set.begin();
       it != Set.end(); it++)
    cout << (*it).second << ' ';
}
