#include <bits/stdc++.h>
#define MAXN 1000010
#define ll long long
using namespace std;
ll a[MAXN], b[MAXN];
int main()
{
    ll n, m;
    cin >> n >> m;
    if (n==2)
    {
        for (ll i=1; i<=m; i++)
        {
            ll x; cin >> x;
            a[i]=a[i-1]+x;
        }
        for (ll i=1; i<=m; i++)
        {
            ll x; cin >> x;
            b[i]=b[i-1]+x;
        }
        ll ans=LONG_MAX;
        for(ll i=1; i<=m; i++)
        {
            ll cur=a[m]-a[i];
            for (ll j=1; j<i; j++)
                cur+=(b[j]-b[j-1])*j;
            ans=min(ans, cur);
        }
        cout << ans << endl;
        return 0;
    }
    return 0;
}