#include <bits/stdc++.h>
using namespace std;
const int maxn = 2009;
int a[maxn], b[maxn];
int n, K, ans, flag, p, d;
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    a[i] += a[i - 1];
  }
  for (int j = 1; j <= K; j++) scanf("%d", &b[j]);
  sort(a + 1, a + n + 1);
  sort(b + 1, b + K + 1);
  for (int i = 1; i <= n - K + 1; i++) {
    if (i != 1 && a[i] == a[i - 1]) continue;
    flag = 1;
    p = i + 1;
    d = b[1] - a[i];
    for (int j = 2; j <= K; j++) {
      while (p <= n && b[j] - a[p] != d) p++;
      if (p > n) {
        flag = 0;
        break;
      }
      p++;
    }
    ans += flag;
  }
  printf("%d\n", ans);
  return 0;
}
