#include <bits/stdc++.h>
using namespace std;
int a[2005], b[2005];
bool has[16000010], vis[16000010];
set<int> ans;
int k, n;
bool check(int pos) {
  int initial = b[0] - a[pos];
  vis[b[0] + 8000000] = true;
  for (int i = 0; i < k; ++i) {
    if (i == pos)
      continue;
    else {
      int expect = initial + a[i];
      if (has[expect + 8000000] && !vis[expect + 8000000])
        vis[expect + 8000000] = true;
    }
  }
  bool ans = true;
  for (int i = 0; i < n; ++i) {
    if (!vis[b[i] + 8000000]) ans = false;
    vis[b[i] + 8000000] = false;
  }
  return ans;
}
int main(int argc, char* argv[]) {
  scanf("%d%d", &k, &n);
  for (int i = 0; i < k; ++i) {
    scanf("%d", &a[i]);
    if (i > 0) a[i] += a[i - 1];
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", &b[i]);
    has[b[i] + 8000000] = true;
  }
  for (int i = 0; i < k; ++i) {
    int initial = b[0] - a[i];
    if (check(i)) ans.insert(initial);
  }
  printf("%u\n", (unsigned int)ans.size());
  return 0;
}
