atcoder#ABC248E. [ABC248E] K-colinear Line

[ABC248E] K-colinear Line

Score : 500500 points

Problem Statement

You are given NN points in the coordinate plane. For each 1iN1\leq i\leq N, the ii-th point is at the coordinates (Xi,Yi)(X_i, Y_i).

Find the number of lines in the plane that pass KK or more of the NN points. If there are infinitely many such lines, print Infinity.

Constraints

  • 1KN3001 \leq K \leq N \leq 300
  • Xi,Yi109\lvert X_i \rvert, \lvert Y_i \rvert \leq 10^9
  • XiXjX_i\neq X_j or YiYjY_i\neq Y_j, if iji\neq j.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN KK

X1X_1 Y1Y_1

X2X_2 Y2Y_2

\vdots

XNX_N YNY_N

Output

Print the number of lines in the plane that pass KK or more of the NN points, or Infinity if there are infinitely many such lines.

5 2
0 0
1 0
0 1
-1 0
0 -1
6

The six lines x=0x=0, y=0y=0, y=x±1y=x\pm 1, and y=x±1y=-x\pm 1 satisfy the requirement. For example, x=0x=0 passes the first, third, and fifth points.

Thus, 66 should be printed.

1 1
0 0
Infinity

Infinitely many lines pass the origin.

Thus, Infinity should be printed.