#include <bits/stdc++.h>
using namespace std;
int suff[2005];
int n, k;
int scores[2005];
short sv[int(3e7)];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", suff + i);
    if (i) suff[i] += suff[i - 1];
  }
  for (int i = 0; i < k; i++) {
    scanf("%d", &scores[i]);
    scores[i] += (8000005) / 2 + (2005 * 2005);
  }
  vector<int> v;
  int ans = 0;
  for (int j = 0; j < k; j++) {
    vector<int> v;
    for (int i = 0; i < n; i++) {
      v.push_back(scores[j] - suff[i]);
    }
    sort(v.begin(), v.end());
    v.resize(unique(v.begin(), v.end()) - v.begin());
    for (auto c : v) {
      sv[c]++;
      if (sv[c] == k) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
