#include <bits/stdc++.h>
using namespace std;
int a[2020], b[2020];
long long sum[2020];
int main() {
  int n, k;
  scanf("%d%d", &k, &n);
  sum[0] = 0;
  for (int i = 1; i <= k; i++) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = 1; i <= n; i++) scanf("%d", &b[i]);
  sort(sum + 1, sum + k + 1);
  int sz = unique(sum + 1, sum + k + 1) - sum - 1;
  int cnt = sz;
  for (int i = 1; i <= sz; i++) {
    int initial = b[1] - sum[i];
    for (int j = 1; j <= n; j++) {
      if (!binary_search(sum + 1, sum + sz + 1, b[j] - initial)) {
        cnt--;
        break;
      }
    }
  }
  printf("%d\n", cnt);
}
