#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
const int mod = 20090717;
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
int sum[maxn];
vector<int> vec;
map<int, int> mp;
int main() {
  int n, k;
  int x;
  sum[0] = 0;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    sum[i] = sum[i - 1] + x;
  }
  sort(sum + 1, sum + 1 + n);
  int len = unique(sum + 1, sum + 1 + n) - (sum + 1);
  for (int i = 1; i <= k; i++) {
    scanf("%d", &x);
    for (int j = 1; j <= len; j++) {
      int temp = x - sum[j];
      vec.push_back(temp);
    }
  }
  sort(vec.begin(), vec.end());
  int num = 0;
  for (int i = 0; i < vec.size(); i++) {
    mp[vec[i]]++;
  }
  for (int i = 0; i < vec.size(); i++) {
    if (mp[vec[i]] >= k) {
      num++;
      mp[vec[i]] = 0;
    }
  }
  printf("%d\n", num);
}
