#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
#define rep(i,k,n) for(int i = k ; i < n ; i++ )
double G[101][101];
int main(){
  int n,m;
  while( cin >> n >> m,n+m){

    rep(i,1,n+1)
      rep(j,1,n+1)cin >> G[i][j];

    double dp[101][101];

    fill(dp[0],dp[101],0);

    rep(j,0,n+1)dp[1][j] = 1;

    double mx = 0;

    rep(i,2,m+1){
      rep(j,1,n+1){
	rep(k,1,n+1){
	  dp[i][j] = max(dp[i][j],dp[i-1][k] * G[k][j]);
	}
      }
    }

    rep(j,1,n+1)mx = max(mx,dp[m][j]);
    printf("%.2f\n",mx);

  }
  return 0;
}