#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
inline void read(int &x) {
  char ch = getchar();
  int f = 1;
  x = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  x *= f;
}
int n, m, p[100050], v[100050], nx[100050], pr[100050], id[100050];
set<pair<int, int> > se;
int get(int x, int y) {
  if (x == y) return 1000000005;
  int d = (p[y] - p[x] + m) % m;
  if (x > y) d += v[y];
  if (d <= v[x]) return 1;
  if (v[x] <= v[y]) return 1000000005;
  return (d - v[y] - 1) / (v[x] - v[y]) + 1;
}
bool cmp(int x, int y) { return p[x] < p[y]; }
int main() {
  read(n), read(m);
  for (register int i = 1; i <= n; ++i)
    read(p[i]), --p[i], read(v[i]), id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  for (register int i = 1; i <= n; ++i)
    pr[id[i]] = id[i - 1], nx[id[i]] = id[i + 1];
  nx[pr[id[1]] = id[n]] = id[1];
  for (register int i = 1; i <= n; ++i) se.insert(make_pair(get(i, nx[i]), i));
  while (1) {
    set<pair<int, int> >::iterator it = se.begin();
    if (it->first >= 1000000005) break;
    int u = it->second, t = it->first;
    se.erase(it);
    se.erase(make_pair(get(pr[u], u), pr[u])),
        se.erase(make_pair(get(nx[u], nx[nx[u]]), nx[u]));
    pr[nx[u] = nx[nx[u]]] = u;
    p[u] = (p[u] + t) % m, --v[u];
    se.insert(make_pair(get(pr[u], u), pr[u])),
        se.insert(make_pair(get(u, nx[u]), u));
  }
  printf("%d\n", se.size());
  for (auto v : se) printf("%d ", v.second);
  puts("");
  return 0;
}
