#include <bits/stdc++.h>
using namespace std;
int bucket[16000005];
int main(int argc, char *argv[]) {
  int k, n;
  scanf("%d%d", &k, &n);
  int *a = new int[k];
  int last = 0;
  for (int i = 0; i < k; i++) {
    scanf("%d", a + i);
    a[i] = a[i] + last;
    last = a[i];
  }
  int value, j, target;
  for (int i = 0; i < n; i++) {
    scanf("%d", &value);
    for (j = 0; j < k; j++) {
      target = value - a[j];
      if (bucket[target + 8000000] == i) {
        bucket[target + 8000000] = i + 1;
      }
    }
  }
  int count = 0;
  for (int i = 0; i < 16000005; i++) {
    if (bucket[i] == n) {
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}
