#include <bits/stdc++.h>
using namespace std;
int n, k, a[2005], bb[2005];
map<int, int> b;
map<int, int> ans;
void check(int x) {
  int now = bb[1] - a[x];
  map<int, int> ret;
  for (int i = 1; i <= k; i++) {
    int tmp = now + a[i];
    if (b.count(tmp) == 1) ret[tmp] = 1;
  }
  if (ret == b) ans[now] = 1;
}
int main() {
  while (scanf("%d%d", &k, &n) != EOF) {
    ans.clear();
    b.clear();
    for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
    for (int i = 2; i <= k; i++) a[i] = a[i - 1] + a[i];
    for (int i = 1; i <= n; i++) {
      scanf("%d", &bb[i]);
      b[bb[i]] = 1;
    }
    for (int i = 1; i <= k; i++) check(i);
    printf("%d\n", ans.size());
  }
  return 0;
}
