#include <bits/stdc++.h>
using namespace std;
long long int n, k;
long long int score[20000];
long long int remembered[20000];
long long int anotherscore[20000];
vector<long long int> vec;
set<long long int> answer;
set<long long int> beed;
set<long long int> counter;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> score[i];
  }
  for (int i = 0; i < k; i++) {
    cin >> remembered[i];
    counter.insert(remembered[i]);
  }
  long long int sum = remembered[0] - score[0];
  vec.push_back(sum);
  for (int i = 1; i < n; i++) {
    sum -= score[i];
    vec.push_back(sum);
  }
  for (int i = 0; i < vec.size(); i++) {
    int sumone = vec[i];
    for (int j = 0; j < n; j++) {
      sumone += score[j];
      if (counter.count(sumone)) {
        answer.insert(sumone);
      }
    }
    if (answer.size() == k) {
      beed.insert(vec[i]);
    }
    answer.clear();
  }
  printf("%d\n", beed.size());
  return 0;
}
