#include <bits/stdc++.h>
const int MAXN = 100000;
int n, k;
int Ax, Bx, Cx, Ay, By, Cy;
int a[MAXN + 10], b[MAXN + 10], c[MAXN + 10];
int sta[MAXN + 10], top;
std::pair<int, int> ans[10];
int anst;
void dfs(int id) {
  if (top <= id) {
    for (int i = 1; i <= top; i++) ans[++anst] = std::make_pair(sta[i], -1);
    puts("YES");
    printf("%d\n", anst);
    for (int i = 1; i <= anst; i++)
      printf("%d %d\n", ans[i].first, ans[i].second);
    exit(0);
  }
  if (id == 0) return;
  int st[MAXN + 10], tp = 0;
  for (int ci = 0; ci <= id * 3; ci++) {
    int first = rand() % top + 1, second = rand() % top + 1;
    while (second == first) second = rand() % top + 1;
    Ax = a[sta[first]];
    Bx = b[sta[first]];
    Cx = c[sta[first]];
    Ay = a[sta[second]];
    By = b[sta[second]];
    Cy = c[sta[second]];
    if (1LL * Ax * By == 1LL * Ay * Bx) continue;
    int ttop = top;
    ans[++anst] = std::make_pair(sta[first], sta[second]);
    for (int i = 1; i <= top; i++)
      while (i <= top &&
             ((1LL * a[sta[i]] * (1LL * Bx * Cy - 1LL * By * Cx) +
                   1LL * b[sta[i]] * (1LL * Ay * Cx - 1LL * Ax * Cy) +
                   1LL * c[sta[i]] * (1LL * Ax * By - 1LL * Ay * Bx) ==
               0))) {
        st[++tp] = sta[i];
        std::swap(sta[i], sta[top]);
        top--;
      }
    if (top <= ((id - 1) > ((int)(ttop * (1.0 - 1.0 / (2 * id))))
                    ? (id - 1)
                    : ((int)(ttop * (1.0 - 1.0 / (2 * id))))))
      dfs(id - 1);
    while (tp) sta[++top] = st[tp--];
    anst--;
  }
  return;
}
void init() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    sta[++top] = i;
    scanf("%d%d%d", &a[i], &b[i], &c[i]);
  }
  dfs(k);
  puts("NO");
  return;
}
int main() {
  srand(time(0));
  init();
  return 0;
}
