#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> a;
vector<long long> b;
long long sum[2001];
set<long long> S;
set<long long> P;
int32_t main() {
  cin >> k >> n;
  for (long long i = 1; i <= k; i++) {
    long long x;
    cin >> x;
    sum[i] = sum[i - 1] + x;
  }
  for (long long i = 1; i <= n; i++) {
    long long z;
    cin >> z;
    b.push_back(z);
  }
  long long x;
  sort(b.begin(), b.end());
  for (long long m = 1; m <= k; m++) {
    x = b[0] - sum[m];
    S.insert(x);
  }
  long long rs = 0;
  for (auto d : S) {
    set<long long> K;
    for (long long i = 1; i <= k; i++) {
      K.insert(d + sum[i]);
    }
    long long j = 0;
    for (; j < n; j++) {
      if (K.find(b[j]) == K.end()) {
        break;
      }
    }
    if (j == n) P.insert(d);
  }
  cout << P.size();
  return 0;
}
