#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:10000000000")
using namespace std;
void print_str(const char *s) {
  while (*s != 0) {
    putchar(*s);
    s++;
  }
}
template <typename T>
void scan(T &t) {
  cin >> t;
}
template <>
void scan<int>(int &t) {
  scanf("%d", &t);
}
template <>
void scan<long long>(long long &t) {
  scanf("%lld", &t);
}
template <>
void scan<string>(string &t) {
  cin >> t;
}
template <>
void scan<char *>(char *&t) {
  scanf("%s", t);
}
template <>
void scan<char>(char &t) {
  t = getchar();
  while (t <= 32) t = getchar();
}
template <>
void scan<double>(double &t) {
  scanf("%lf", t);
}
template <typename T>
void scan(vector<T> &t) {
  for (int i = 0; i < t.size(); i++) {
    scan(t[i]);
  }
}
template <typename T, typename... Ts>
void scan(T &t, Ts &...ts) {
  scan(t);
  scan(ts...);
}
template <typename T>
void print(T t) {
  cout << t;
}
template <>
void print<string>(string s) {
  print_str(s.c_str());
}
template <>
void print<int>(int t) {
  printf("%d", t);
}
template <>
void print<long long>(long long t) {
  printf("%lld", t);
}
template <>
void print<char>(char t) {
  putchar(t);
}
template <>
void print<const char *>(const char *t) {
  print_str(t);
}
template <>
void print<double>(double t) {
  printf("%lf", t);
}
template <typename T, typename V>
void print(pair<T, V> t) {
  printf("(");
  print(t.first);
  printf(", ");
  print(t.second);
  printf(")");
}
template <typename T, typename... Ts>
void print(T t, Ts... ts) {
  print(t);
  print(ts...);
}
const int INF = 1e9;
const long long LINF = 3e18;
const int maxN = 2000 + 100;
const int maxM = 4e6;
const int K = 3000;
const int SIZE = (1 << 19);
const int mb = 30;
const long long MOD = 100000000000000003;
const long long P = 1009;
const double EPS = 1e-8;
mt19937_64 random_generator;
long long random(long long l, long long r) {
  uniform_int_distribution<long long> dist(l, r);
  long long res = dist(random_generator);
  return res;
}
int a[maxN];
int b[maxN];
int z[maxN];
bool here[3 * maxM];
int main() {
  int k, n;
  scan(k, n);
  int pr = 0;
  for (int i = 0; i < k; i++) {
    scan(a[i]);
    z[i] = pr + a[i];
    pr = z[i];
  }
  for (int i = 0; i < n; i++) {
    scan(b[i]);
    b[i] += maxM;
    here[b[i]] = true;
  }
  set<int> res;
  for (int i = 0; i < k; i++) {
    int cnt = 0;
    int st = b[0] - z[i];
    int sst = st;
    for (int j = 0; j < k; j++) {
      st += a[j];
      if (here[st]) {
        cnt++;
        here[st] = false;
      }
    }
    if (cnt == n) res.insert(sst);
    for (int j = 0; j < n; j++) {
      here[b[j]] = true;
    }
  }
  print(res.size());
  return 0;
}
