#include <iostream>
#define ll long long
using namespace std;
ll* x, *d, *a;
ll n, t;
ll len(ll c, ll tm)
{
    if(d[c] <= tm) return a[c] + len(x[c] - 1, tm - d[c]);
    return a[c];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> t;
    x = new ll[n];
    d = new ll[n];
    a = new ll[n];
    ll m = 0;
    for(ll i = 0; i < n; i++) cin >> a[i];
    for(ll i = 0; i < n; i++) cin >> x[i];
    for(ll i = 0; i < n; i++) cin >> d[i];
    for(ll i = 0; i < n; i++)
    {
        ll tmp = len(i, t);
        if(tmp > m) m = tmp;
    }
    cout << m;
}