A little boy Petya dreams of growing up and becoming the Head Berland Plumber. He is thinking of the problems he will have to solve in the future. Unfortunately, Petya is too inexperienced, so you are about to solve one of such problems for Petya, the one he's the most interested in.

The Berland capital has n water tanks numbered from 1 to n. These tanks are connected by unidirectional pipes in some manner. Any pair of water tanks is connected by at most one pipe in each direction. Each pipe has a strictly positive integer width. Width determines the number of liters of water per a unit of time this pipe can transport. The water goes to the city from the main water tank (its number is 1). The water must go through some pipe path and get to the sewer tank with cleaning system (its number is n). 

Petya wants to increase the width of some subset of pipes by at most k units in total so that the width of each pipe remains integer. Help him determine the maximum amount of water that can be transmitted per a unit of time from the main tank to the sewer tank after such operation is completed.

Input

The first line contains two space-separated integers n and k (2 ≤ n ≤ 50, 0 ≤ k ≤ 1000). Then follow n lines, each line contains n integers separated by single spaces. The i + 1-th row and j-th column contain number cij — the width of the pipe that goes from tank i to tank j (0 ≤ cij ≤ 106, cii = 0). If cij = 0, then there is no pipe from tank i to tank j.

Output

Print a single integer — the maximum amount of water that can be transmitted from the main tank to the sewer tank per a unit of time.

Examples

Input

5 7
0 1 0 2 0
0 0 4 10 0
0 0 0 0 5
0 0 0 0 10
0 0 0 0 0


Output

10


Input

5 10
0 1 0 0 0
0 0 2 0 0
0 0 0 3 0
0 0 0 0 4
100 0 0 0 0


Output

5

Note

In the first test Petya can increase width of the pipe that goes from the 1st to the 2nd water tank by 7 units.

In the second test Petya can increase width of the pipe that goes from the 1st to the 2nd water tank by 4 units, from the 2nd to the 3rd water tank by 3 units, from the 3rd to the 4th water tank by 2 units and from the 4th to 5th water tank by 1 unit.
#include <bits/stdc++.h>
using namespace std;
struct edge {
  int b;
  int cap, f, cost;
  int rev_id;
};
vector<edge> E[55];
int dist[55];
int from[55];
int from_edge[55];
int res[55];
struct cmp {
  bool operator()(int &a, int &b) { return dist[a] > dist[b]; }
};
int find_aug(int s, int t) {
  for (int n = s; n <= t; ++n) {
    dist[n] = 1e9;
    res[n] = 0;
  }
  priority_queue<int, vector<int>, cmp> Q;
  dist[s] = 0;
  res[s] = 1e9;
  Q.push(s);
  int x;
  while (Q.size() > 0) {
    x = Q.top();
    Q.pop();
    if (x == t) {
      return res[t];
    }
    for (int n = 0; n < E[x].size(); ++n) {
      int y = E[x][n].b;
      int c = min(E[x][n].cap - E[x][n].f, res[x]);
      int newdist = dist[x] + E[x][n].cost;
      if (c && (newdist < dist[y])) {
        dist[y] = newdist;
        res[y] = c;
        from[y] = x;
        from_edge[y] = n;
        Q.push(y);
      }
    }
  }
  return res[t];
}
int mincostmaxflow(int N, int K) {
  int Ans = 0;
  int flow = 0;
  int temp = 0;
  int cst = 0;
  while (temp = find_aug(0, N - 1)) {
    if (dist[N - 1] > 0) {
      temp = min(temp, (int)1);
    }
    for (int j = N - 1, i = from[j]; j != 0; j = i, i = from[j]) {
      int x = from_edge[j];
      int y = E[i][x].rev_id;
      E[i][x].f += temp;
      E[j][y].f -= temp;
    }
    cst += temp * dist[N - 1];
    flow += temp;
    if (cst <= K) {
      Ans = max(Ans, flow);
    } else {
      break;
    }
  }
  return Ans;
}
void add_edge(int a, int b, int cap, int cost) {
  edge x = {b, cap, 0, cost, (int)E[b].size()};
  edge y = {a, 0, 0, -cost, (int)E[a].size()};
  E[a].push_back(x);
  E[b].push_back(y);
}
int main() {
  int N, K;
  cin >> N >> K;
  int x;
  for (int n = 0; n < N; ++n) {
    for (int m = 0; m < N; ++m) {
      scanf("%d", &x);
      if (!x) {
        continue;
      }
      add_edge(n, m, x, 0);
      add_edge(n, m, K, 1);
    }
  }
  int Ans = mincostmaxflow(N, K);
  cout << Ans << endl;
  return 0;
}
