#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int inf = 0x3f3f3f3f;
const long long int INF = 1e15;
const int mod = 1e9 + 7;
const int maxn = 2e3 + 5;
int cas = 1;
int sum[maxn];
vector<int> v;
map<int, int> mp;
void solve() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    memset(sum, 0, sizeof(sum));
    v.clear();
    mp.clear();
    for (int i = 1; i <= n; i++) {
      int u;
      scanf("%d", &u);
      sum[i] = sum[i - 1] + u;
    }
    sort(sum + 1, sum + 1 + n);
    int len = unique(sum + 1, sum + 1 + n) - (sum + 1);
    for (int i = 1; i <= k; i++) {
      int u;
      scanf("%d", &u);
      for (int j = 1; j <= len; j++) {
        v.push_back(u - sum[j]);
      }
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < v.size(); i++) {
      mp[v[i]]++;
    }
    int res = 0;
    for (int i = 0; i < v.size(); i++) {
      if (mp[v[i]] >= k) {
        res++;
        mp[v[i]] = 0;
      }
    }
    printf("%d\n", res);
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
}
