#include <bits/stdc++.h>
using namespace std;
int k, n, flag, cnt = 0, sta;
int a[2005], b[2005], tmp[2005], vis[9000000];
void solve(int x) {
  int i, j;
  int begin = b[0] - a[x];
  flag = 1;
  memset(tmp, 0, sizeof(tmp));
  for (i = 0; i < k; i++) {
    tmp[i] = begin + a[i];
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < k; j++) {
      if (b[i] == tmp[j]) {
        break;
      }
    }
    if (j == k) {
      flag = 0;
      break;
    }
  }
  if (flag) {
    for (i = 0; i < sta; i++)
      if (begin == vis[i]) return;
    cnt++;
  }
  vis[sta++] = begin;
}
int main() {
  int i;
  memset(vis, 0, sizeof(vis));
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  scanf("%d%d", &k, &n);
  for (i = 0; i < k; i++) {
    scanf("%d", &a[i]);
    if (i) a[i] += a[i - 1];
  }
  for (i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  for (i = 0; i < k; i++) solve(i);
  printf("%d\n", cnt);
  return 0;
}
