#include <iostream>
#include <iomanip>
#include <cmath>
#include <cfloat>
using namespace std;

const int NMAX = 100;

int main() {
  int n, m;
  double dp[2][NMAX];
  double g[NMAX][NMAX];
  double lg[NMAX][NMAX];

  while (1) {
    cin >> n >> m;
    if (!n && !m) {
      break;
    }

    for (int i=0; i<n; ++i) {
      for (int j=0; j<n; ++j) {
        cin >> g[i][j];
        lg[i][j] = log(g[i][j]);
      }
    }
    for (int i=0; i<n; ++i) {
      dp[0][i] = 0.0;
    }

    for (int i=0; i<m-1; ++i) {
      for (int j=0; j<n; ++j) {
        dp[!(i&1)][j] = dp[i&1][0] + lg[0][j];
        for (int k=0; k<n; ++k) {
          dp[!(i&1)][j] = max(dp[!(i&1)][j], dp[i&1][k] + lg[k][j]);
        }
      }
    }

    double lans = -DBL_MAX;
    for (int i=0; i<n; ++i) {
      lans = max(lans, dp[!(m&1)][i]);
    }
    cout << fixed << setprecision(2) << round(exp(lans) * 100) / 100. << endl;
  }
  return 0;
}