#include <bits/stdc++.h>
using namespace std;
const int N = 26;
int main() {
  int k, n;
  cin >> k >> n;
  vector<long long> b(k);
  vector<long long> p(n);
  vector<long long> sum(k);
  for (int i = 0; i < k; i++) {
    cin >> b[i];
    sum[i] = (i == 0 ? b[i] : sum[i - 1] + b[i]);
  }
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  set<long long> pans;
  for (int i = 0; i < 1; i++) {
    for (int j = 0; j < k; j++) {
      pans.insert(p[i] - sum[j]);
    }
  }
  int ans = 0;
  for (auto it = pans.begin(); it != pans.end(); it++) {
    int a = (*it);
    bool ok = true;
    set<long long> pt;
    for (int i = 0; i < k; i++) {
      pt.insert(a + sum[i]);
    }
    for (int i = 0; i < n; i++) ok &= (pt.find(p[i]) != pt.end());
    ans += ok;
  }
  cout << ans << endl;
  return 0;
}
