#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[2000], b[2000], i, j, k, l, m, n, x, y, z;
  scanf("%i %i", &k, &n);
  for (y = i = 0; i < k; scanf("%i", &x), a[i++] = (y += x))
    ;
  sort(a, a + k);
  for (x = a[0], m = i = 1; i < k; i++)
    if ((y = a[i]) != x) x = a[m++] = y;
  for (i = 0; i < n; scanf("%i", &x), b[i++] = x)
    ;
  sort(b, b + n);
  for (x = b[0], y = i = 0; i < n; b[i++] -= x)
    ;
  if (n == 1)
    y = m;
  else
    for (i = 0, k = n; k <= m; i++, k++, y += (l == n))
      for (j = i + 1, l = 1, z = a[i]; j < m && l < n; l += (j < m))
        for (x = z + b[l]; j < m && a[j] != x; j++)
          ;
  printf("%i", y);
}
