#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
map<long long, long long> M;
int main() {
  long long t = 1, n, m, i, j, k, sum = 0, ans = 0;
  string s;
  cin >> k >> n;
  long long a[k], b[n];
  for (i = 0; i < k; i++) {
    cin >> a[i];
    if (i != 0) {
      a[i] = a[i] + a[i - 1];
    }
    if (!M[a[i]]) {
      M[a[i]]++;
      v.push_back(a[i]);
    }
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  sort(v.begin(), v.end());
  sort(b, b + n);
  for (i = 0; i < v.size(); i++) {
    k = 1;
    for (j = 1; j < n; j++) {
      if (!M[v[i] + b[j] - b[0]]) k = 0;
    }
    if (k) ans++;
  }
  cout << ans;
}
