#include using namespace std; int main(){ int n; cin >> n; int m1; cin >> m1; set s; s.insert(0); vector a(m1); for(int i = 0;i < m1;i++){ cin >> a[i]; if(i != 0) a[i] += a[i - 1]; } int m2; cin >> m2; vector b(m2 + 1); b[0] = n; for(int i = 1;i <= m2;i++){ cin >> b[i]; b[i] = b[i - 1] - b[i]; } for(int i = 0;i < m1;i++) s.insert(a[i]); for(int i = 0;i <= m2;i++) s.insert(b[i]); cout << n + 1 - (int)s.size(); }