#include <bits/stdc++.h>
using namespace std;
const int MN = 1e2 + 10;
const int MM = 1e4 + 10;
int n, m;
int shelve[MN][MN], ps[MN][MN];
int sz[MN];
int mx[MN][MN];
int dps[MN][MN][MN];
int dp[MN][MM];
void input() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> sz[i];
    for (int j = 0; j < sz[i]; ++j) {
      cin >> shelve[i][j];
      ps[i + 1][j + 1] = ps[i + 1][j] + shelve[i][j];
    }
  }
}
void prep() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < sz[i]; ++j)
      for (int k = 0; k <= j; ++k) {
        dps[i + 1][j + 1][k + 1] =
            max(shelve[i][j] + dps[i + 1][j][k], ps[i + 1][k + 1]);
      }
  }
}
void solve() {
  for (int i = 0; i < n; ++i)
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= min(sz[i], j); ++k) {
        dp[i + 1][j] = max(dp[i + 1][j], dps[i + 1][sz[i]][k] + dp[i][j - k]);
      }
  cout << dp[n][m] << endl;
}
int main() {
  input();
  prep();
  solve();
  return 0;
}
