#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n; cin >> n; vector dirty(n + 1, false); dirty[0] = dirty[n] = true; int m; cin >> m; int now = 0; rep(i, m) { int a; cin >> a; now += a; dirty[now] = true; } cin >> m; assert(now == n); rep(i, m) { int a; cin >> a; now -= a; dirty[now] = true; } int ans = 0; rep(i, n + 1) { if (!dirty[i]) ans++; } cout << ans << endl; return 0; }