#include <bits/stdc++.h>
const long long N = 1e5 + 5;
long long n, m, p[N], a[N], id[N], L[N], R[N];
std::set<std::pair<long long, long long> > s;
std::set<std::pair<long long, long long> >::iterator I;
inline bool cmp(long long x, long long y) { return p[x] < p[y]; }
inline long long dis(long long x, long long y) {
  if (x == y) return 1e18;
  long long d = (p[y] - p[x] + (x > y) * a[y] + m) % m;
  if (d <= a[x]) return 1;
  if (a[x] <= a[y]) return 1e18;
  return (d - a[y] - 1) / (a[x] - a[y]) + 1;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  long long i;
  for (i = 1; i <= n; i++) scanf("%lld%lld", p + i, a + i), id[i] = i;
  std::sort(id + 1, id + n + 1, cmp);
  for (i = 1; i <= n; i++) L[R[id[i]] = id[i < n ? i + 1 : 1]] = id[i];
  for (i = 1; i <= n; i++) s.insert(std::make_pair(dis(i, R[i]), i));
  while (s.size()) {
    if ((*(I = s.begin())).first == 1e18) break;
    i = (*I).second;
    s.erase(I), s.erase(std::make_pair(dis(R[i], R[R[i]]), R[i])),
        s.erase(std::make_pair(dis(L[i], i), L[i]));
    p[i] += dis(i, R[i]), a[i]--, R[i] = R[R[i]], L[R[i]] = i;
    s.insert(std::make_pair(dis(L[i], i), L[i])),
        s.insert(std::make_pair(dis(i, R[i]), i));
  }
  for (printf("%lld\n", (long long)s.size()), I = s.begin(); I != s.end(); I++)
    printf("%lld ", (*I).second);
  return 0 * puts("");
}
