#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k;
  cin >> n >> k;
  vector<long long> a(n), b(k), sm(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    sm[i] = a[i];
    if (i) {
      sm[i] += sm[i - 1];
    }
  }
  for (long long j = 0; j < k; j++) {
    cin >> b[j];
  }
  set<long long> st;
  for (long long i = 0; i < n; i++) {
    st.insert(b[0] - sm[i]);
  }
  long long ans = 0;
  for (auto now : st) {
    set<long long> points;
    for (long long i = 0; i < n; i++) {
      points.insert(now + sm[i]);
    }
    bool ok = 1;
    for (long long i = 0; i < k; i++) {
      if (points.find(b[i]) == points.end()) {
        ok = 0;
        break;
      }
    }
    if (ok) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
