#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 20;   int x[maxn], y[maxn];   int main() {     int n, m;     while (cin >> n >> m) {       for (int i = 1; i <= n; i++) scanf( %d , &x[i]);       for (int j = 1; j <= m; j++) scanf( %d , &y[j]);       int ans = 0;       int p1 = 1, p2 = 1;       long long sum1 = 0, sum2 = 0;       while (p1 <= n || p2 <= m) {         if (sum1 <= sum2) {           if (p1 > n) break;           sum1 += x[p1++];         } else {           if (p2 > m) break;           sum2 += y[p2++];         }         if (sum1 == sum2) ans++;       }       printf( %d n , ans);     }     return 0;   }   