#include <bits/stdc++.h>
using namespace std;
const int maxn = 2002;
set<int> S, Ans;
int A[maxn], B[maxn], K, N;
void init() {
  for (int i = 0; i < K; ++i) scanf("%d", &A[i]);
  for (int i = 0; i < N; ++i) scanf("%d", &B[i]);
  S.clear();
  S.insert(A[0]);
  for (int i = 1; i < K; ++i) {
    A[i] += A[i - 1];
    S.insert(A[i]);
  }
}
void work() {
  for (int i = 0; i < K; ++i) {
    bool t = 1;
    for (int k = 1; k < N && t; ++k)
      if (!S.count(A[i] - B[0] + B[k])) t = 0;
    if (t) Ans.insert(B[0] - A[i]);
  }
  printf("%d\n", Ans.size());
}
int main() {
  while (~scanf("%d%d", &K, &N)) {
    init();
    work();
  }
}
