
import std.stdio, std.algorithm;

void main() {
  for(int n, m; scanf("%d %d\n", &n, &m), n != 0;) {
    double[][] table = new double[][](n, n);
    double[] dp = new double[](n);
    int[] next = new int[](n);
    double ans = double.min;
    for(int i = 0; i < n; i++)
      for(int j = 0; j < n; j++)
        scanf(j == n - 1 ?  "%lf\n" : "%lf ", &table[i][j]);

    dp[] = 0.0;

    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++) {
        if (dp[i] < table[i][j]) {
          next[i] = j;
          dp[i] = table[i][j];
        }
      }
    }

    for(int i = 0; i < n; i++) {
      int k = i;
      double value = 1.0;
      for(int j = 0; j < m - 1; j++) {
        value *= dp[k];
        k = next[k];
      }
      if (ans < value) ans = value;
    }
    writeln(ans);
  }
}