#include <bits/stdc++.h>
using namespace std;
vector<int> instersection(vector<int> &v1, vector<int> &v2) {
  vector<int> v3;
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(),
                   back_inserter(v3));
  return v3;
}
int main() {
  int k, n;
  vector<int> sums;
  vector<int> ans;
  cin >> k;
  cin >> n;
  sums.push_back(0);
  cin >> sums[0];
  for (int i = 1; i < k; ++i) {
    int tmp;
    cin >> tmp;
    if (tmp != 0) {
      sums.push_back(sums.back() + tmp);
    }
  }
  int tmp;
  cin >> tmp;
  for (int i = 0; i < sums.size(); ++i) {
    ans.push_back(tmp - sums[i]);
  }
  for (int i = 1; i < n; ++i) {
    vector<int> currentVector;
    vector<int> tmpVector;
    int tmp;
    cin >> tmp;
    for (int i = 0; i < sums.size(); ++i) {
      currentVector.push_back(tmp - sums[i]);
    }
    tmpVector = instersection(ans, currentVector);
    ans = tmpVector;
  }
  cout << ans.size();
}
