#include <bits/stdc++.h>
using namespace std;
const int MAXN = 8000000 + 10;
const int MAX = 2000 + 10;
const int A = 4000000;
int a[MAX], b[MAX];
map<int, bool> T;
bool vis[MAXN];
int main(int argc, char const *argv[]) {
  int k, n;
  while (scanf("%d%d", &k, &n) != EOF) {
    for (int i = 1; i <= k; i++) {
      scanf("%d", &a[i]);
      a[i] = a[i] + a[i - 1];
    }
    for (int i = 1; i <= n; i++) {
      scanf("%d", &b[i]);
    }
    memset(vis, false, sizeof(vis));
    T.clear();
    int ans = 0;
    for (int i = 1; i <= k; i++) {
      int v = b[1] - a[i];
      if (T[v]) {
        continue;
      }
      T[v] = true;
      int cnt = 0;
      for (int j = 1; j <= n; j++) {
        vis[b[j] + A] = true;
      }
      for (int j = 1; j <= k; j++) {
        int t = v + a[j];
        if (t < -4000000 || t > 4000000) {
          continue;
        }
        if (vis[t + A]) {
          vis[t + A] = false;
          cnt++;
        }
      }
      if (cnt == n) {
        ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
