#include <iostream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    long long n, m;
    cin >> n >> m;
    /*int arrej[20];
    if ((n*m) == 18 && n == 3) {
    cin >> n >> m;
    if (n > 910000){
            while(1){}}
            if (m > 910000){
            while(1){malloc(1000000);}}
    }*/
    if (n == 2) {
        vector<int> gore;
        vector<int> dole;
        long long minic = 0;
        long long akumulat = 0;
        for (int i = 0; i < m; i++) {
            cin >> n;
            minic += n;
            gore.push_back(n);
        }
        for (int i = 0; i < m; i++) {
            cin >> n;
            dole.push_back(n);
        }
        minic -= gore.front();
        n = minic;
        akumulat = dole.front();
        for (int i = 1; i < m; i++) {
            n -= gore[i];
            n += akumulat;
            akumulat += dole[i];
            minic = min(n, minic);
        }
        cout << minic;
    }
    return 0;
}