#include <bits/stdc++.h>
using namespace std;
long long n, m, p[100010], a[100010], id[100010], nex[100010], pre[100010];
set<pair<int, int> > q;
set<pair<int, int> >::iterator it;
bool cmp(int x, int y) { return p[x] < p[y]; }
long long dis(long long s, long long t) {
  if (s == t) return (int)(1e9 + 1000);
  long long d = (p[t] - p[s] + m) % m;
  if (s > t) d = (d + a[t]) % m;
  if (d <= a[s]) return 1;
  if (a[s] <= a[t]) return (int)(1e9 + 1000);
  long long di = a[s] - a[t];
  return (d - a[t] - 1) / di + 1;
}
int main() {
  scanf("%lld%lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &p[i], &a[i]);
    id[i] = i;
  }
  sort(id + 1, id + 1 + n, cmp);
  for (int i = 1; i <= n; i++) {
    if (i == n)
      nex[id[i]] = id[1];
    else {
      nex[id[i]] = id[i + 1];
    }
    pre[nex[id[i]]] = id[i];
  }
  for (int i = 1; i <= n; i++) {
    q.insert(make_pair(dis(i, nex[i]), i));
  }
  while (!q.empty()) {
    it = q.begin();
    if ((*it).first == (int)(1e9 + 1000)) break;
    int now = (*it).second;
    q.erase(it);
    q.erase(make_pair(dis(nex[now], nex[nex[now]]), nex[now]));
    q.erase(make_pair(dis(pre[now], now), pre[now]));
    p[now] += dis(now, nex[now]);
    a[now]--;
    nex[now] = nex[nex[now]];
    pre[nex[now]] = now;
    q.insert(make_pair(dis(pre[now], now), pre[now]));
    q.insert(make_pair(dis(now, nex[now]), now));
  }
  printf("%lld\n", (long long)(q.size()));
  while (!q.empty()) {
    printf("%lld ", (long long)((*q.begin()).second));
    q.erase(q.begin());
  }
}
