#include using namespace std; int main() { int N, M1, M2; cin >> N >> M1; vector v( N + 1 ); int now = 0; v[now] = 1; for( int i = 0; i < M1; i++ ) { int a; cin >> a; now += a; v[now] = 1; } cin >> M2; for( int i = 0; i < M2; i++ ) { int b; cin >> b; now -= b; v[now] = 1; } int ans = 0; for( int i = 0; i < N + 1; i++ ) { if( v[i] == 0 ) ans++; } cout << ans << endl; }