#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Tapris = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int n, m;
double g[111][111];

double dp[111][111];

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(2);

  while(cin >> n >> m, n || m) {
    rep(i, n) rep(j, n) cin >> g[i][j];

    fill(dp[0], dp[111], 0.0);
    rep(i, n) dp[0][i] = 1.0;
    rep(i, m-1) {
      rep(j, n) {
	rep(k, n) {
	  chmax(dp[i+1][j], dp[i][k]*g[k][j]);
	}
      }
    }
    double ans = 0;
    rep(i, n) chmax(ans, dp[m-1][i]);
    cout << ans << endl;
  }

  return 0;
}

