#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cassert>
#include<cmath>
#define EPS 1e-10
using namespace std;
int m,n;
double total;
double dp[110][110];
int Just;
//vector<double> matrix[110];
double matrix[110][110];
/*
double rec(int next,int counter){
  if(dp[next][counter] > 0)return dp[next][counter];
  if(counter  == 0){
    return 1.0;
  }
  double HANMA = 0.0,test=0.0;
 
 
  for(int i=0;i<n;i++){   
    
    //HANMA = max(HANMA,rec(i,counter-1)*matrix[next][i]);
    test = rec(i,counter-1)*matrix[next][i];
    if(test > HANMA)HANMA = test;
  }  
  dp[Just][counter] = HANMA;
  return HANMA;
}
*/

int main(){
  
  double In;
 
  while(cin >> n >> m && n && m){
    //for(int i=0;i<=n;i++)matrix[i].clear();
    
    for(int i=m;i>=0;i--)for(int j=0;j<n;j++)dp[j][i] = -10;
   
 

    for(int i=0;i<n;i++){
      for(int j=0;j<n;j++){
	scanf("%lf",&matrix[i][j]);
      }
    }
  for(int i=0;i<n;i++)dp[i][0] = dp[i][1] = 1;

    double ans = -1; 
    for(int i=2;i<=m;i++){
      for(int j=0;j<n;j++){
	ans = -1;
	for(int k=0;k<n;k++)if(ans < dp[k][i-1]*matrix[j][k])ans = dp[k][i-1]*matrix[j][k];
      
	dp[j][i] = ans;
      }
    }  
 
    double Fans = 0;
    for(int i=0;i<n;i++)if(Fans < dp[i][m])Fans = dp[i][m];
      //cout << endl;

    printf("%.2f\n",Fans);

  }
  return 0;
}