/*
TASK:BOOKS
LANG:C++
*/

#include <stdio.h>
#include <float.h>


using namespace std;

#define IN "books.in"
#define OUT "books.out"

#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define LL long long
#define MAXN 256

LL dp[MAXN][MAXN] = {};
LL bp[MAXN] = {};
LL pp[MAXN] = {};
LL N,K;

int main () {
//    freopen(IN,"r",stdin);
//    freopen(OUT,"w",stdout);

    scanf("%lld%lld",&N,&K);
    for (int i=1; i<=N; i++) {
        scanf("%lld",&bp[i]);
    }
    for (int j=1; j<=N; j++) {
        scanf("%lld",&pp[j]);
    }

    LL s;


    for (int i=1; i<=N; i++) {
        for (int j=1; j<=N; j++) {
            dp[i][j] = (2<<30-1);
        }
    }

    s = 0;
    for (int i=1; i<=N; i++) {
        s += bp[i]*pp[i];
        dp[i][1] = s;
    }

    for (int i=1; i<N; i++) {
        for (int j=2; j<=MIN(i+1,K); j++) {
            s = dp[i][j-1];
            for (int k=1; k+i<=N; k++) {
                s += bp[k+i]*pp[k];
                dp[i+k][j] <?= s;
            }
        }
    }

    LL ans = (2<<30-1);
    for (int i=1; i<=K; i++) {
        ans <?= dp[N][i];
    }
    printf("%lld\n",ans);
    return 0;
}
