#include <bits/stdc++.h>
using namespace std;
int inf = 1E9 + 100;
int matches[16000000];
map<int, int> hit;
int v[3000];
int r[3000];
int main() {
  memset(matches, 0, sizeof(matches));
  int k, n;
  cin >> k;
  cin >> n;
  int sum = 0;
  int aux;
  vector<int> ans;
  for (int i = 0; i < k; ++i) {
    scanf("%d", &aux);
    sum += aux;
    v[i] = sum;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &aux);
    r[i] = aux;
    for (int j = 0; j < k; ++j) {
      matches[aux - v[j] + 8000000]++;
    }
  }
  int cont = 0;
  for (int i = 0; i < 16000000; ++i) {
    if (matches[i] >= n) ans.push_back(i - 8000000);
  }
  for (int i = 0; i < ans.size(); ++i) {
    hit.clear();
    for (int j = 0; j < k; ++j) {
      hit[ans[i] + v[j]] = 1;
    }
    int f = 0;
    for (int j = 0; j < n; ++j) {
      if (hit[r[j]] == 0) {
        f = 1;
        break;
      }
    }
    if (!f) {
      cont++;
    }
  }
  printf("%d\n", cont);
}
