#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
using namespace std;
int64_t dp[3005][3005];
int main() {
  ios::sync_with_stdio(false), cin.tie(nullptr);
  int n, k, t, a;
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> t;
    int64_t sum = 0;
    for (int j = 1; j <= k; j++) dp[i][j] = dp[i - 1][j];
    for (int j = 1; j <= t; j++) {
      cin >> a;
      sum += a;
      for (int z = j; z <= k; z++)
        dp[i][z] = max(dp[i][z], dp[i - 1][z - j] + sum);
    }
  }
  cout << dp[n][k] << '\n';
  return 0;
}
