#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int A[2000];
  int B[2000];
  for (int i = 0; i < n; i++) cin >> A[i];
  for (int i = 0; i < k; i++) cin >> B[i];
  vector<int> V;
  int Sum[2000];
  Sum[0] = A[0];
  for (int i = 1; i < n; i++) Sum[i] = Sum[i - 1] + A[i];
  for (int i = 0; i < n; i++) V.push_back(B[0] - Sum[i]);
  set<int> S;
  for (int i = 0; i < k; i++) S.insert(B[i]);
  int ansv = 0;
  sort(V.begin(), V.end());
  for (int i = 0; i < V.size(); i++) {
    if (i > 0)
      if (V[i] == V[i - 1]) continue;
    int amount = 0;
    set<int> K;
    for (int j = 0; j < n; j++)
      if (S.count(V[i] + Sum[j]) != 0 && K.count(V[i] + Sum[j]) == 0) {
        amount++;
        K.insert(V[i] + Sum[j]);
      }
    if (amount >= k) ansv++;
  }
  cout << ansv;
}
