#include <bits/stdc++.h>
using namespace std;
const int maxN = 5e3;
long long a[maxN], b[maxN];
set<long long> pool, pool2;
bool ok(long long val, int n, int k) {
  pool2 = pool;
  for (int i = 1; i <= n; ++i) {
    val += a[i];
    pool2.erase(val);
  }
  return (int)(pool2.size() == 0);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= k; ++i) cin >> b[i];
  for (int i = 1; i <= k; ++i) {
    pool.insert(b[i]);
  }
  set<long long> answers;
  answers.insert(0);
  long long start = b[1];
  for (int i = 1; i <= n; ++i) {
    start -= a[i];
    answers.insert(start);
  }
  int ans = 0;
  for (set<long long>::iterator it = answers.begin(); it != answers.end();
       ++it) {
    long long val = *it;
    if (ok(val, n, k)) ++ans;
  }
  cout << ans << endl;
  return 0;
}
