#include <bits/stdc++.h>
using namespace std;
int a[2001], b[2001], sum[2001];
int main() {
  int k, n;
  while (~scanf("%d%d", &k, &n)) {
    for (int i = 0; i < k; ++i) scanf("%d", &a[i]);
    for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
    sum[0] = a[0];
    for (int i = 1; i < k; ++i) sum[i] = sum[i - 1] + a[i];
    sort(sum, sum + k);
    int m = unique(sum, sum + k) - sum;
    int ans = 0;
    vector<int> vec;
    map<int, int> mp;
    for (int j = 0; j < m; ++j) {
      for (int i = 0; i < n; ++i) {
        vec.push_back(b[i] - sum[j]);
      }
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < vec.size(); ++i) mp[vec[i]]++;
    for (int i = 0; i < vec.size(); ++i)
      if (mp[vec[i]] >= n) {
        ++ans;
        mp[vec[i]] = 0;
      }
    printf("%d\n", ans);
  }
  return 0;
}
