#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  unordered_multiset<long long> set1;
  unordered_set<long long> global;
  long long k, n;
  cin >> k >> n;
  vector<long long> a(k);
  for (long long i = 0; i < k; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long test;
  cin >> test;
  set1.insert(test);
  for (long long i = 1; i < n; i++) {
    long long t;
    cin >> t;
    set1.insert(t);
  }
  for (long long i = 0; i < k; i++) {
    long long tt = test;
    unordered_multiset<long long> set2 = set1;
    long long cnt = 0;
    if (set2.count(test)) {
      set2.erase(set2.find(test));
      cnt++;
    }
    for (long long j = i + 1; j < k; j++) {
      tt += a[j];
      if (set2.count(tt)) {
        set2.erase(set2.find(tt));
        cnt++;
      }
    }
    tt = test;
    for (long long j = i; j >= 1; j--) {
      tt -= a[j];
      if (set2.count(tt)) {
        set2.erase(set2.find(tt));
        cnt++;
      }
    }
    tt -= a[0];
    if (cnt >= n) {
      global.insert(tt);
    }
  }
  cout << global.size();
  return 0;
}
