#include <iostream>
#include <algorithm>
using namespace std;
int n = 1000001;
int main() {
int ans=0;
int a[n];
int b[n];
int first, numberOfParts;
cin >> first;
cin >> numberOfParts;
for (int i = 0; i < numberOfParts;i++){
cin>>a[i];
}
for (int i=0;i<numberOfParts;i++){
cin>>b[i];
ans = max (ans , b[i]-a[i]);
}
cout<< ans <<endl;
}